Title | Polymorphism and Application to GUIs |
---|---|
Course | Object-Oriented Prog |
Institution | University of Utah |
Pages | 1 |
File Size | 31.8 KB |
File Type | |
Total Downloads | 47 |
Total Views | 142 |
David Johnson...
Lecture 30: Polymorphism and application to GUIs ●
●
●
● ●
●
Polymorphism ○ Generics are a form of polymorphism ○ Operator are a form of polymorphism because ○ Subtype polymorphism References in polymorphism ○ A hava reference can reference a class or any subclass of that class ○ The object that is reference contains info for its class and any super classes Methods ○ A method call is checked in two ways ■ At compile time, the reference type is used to see if the method exists in the reference type class ■ At run time, the reference object method is called Why do this? ○ We want to make general purpose code An application of inheritance ○ Making an user interface ○ Java has an extensive library for user interfaces ■ Java Swing ● There are other similar libraries ■ Will discuss larger structure soon Make an overall application ○ Make a JFrame ■ Window ○ Add the button to it ○ Show it...