June 2017
Beginner
1296 pages
69h 23m
English
You may have noticed in the drawing program created in GUI and Graphics Case Study Exercise 8.2 that shape classes have many similarities. Using inheritance, we can “factor out” the common features from classes MyLine, MyRectangle and MyOval and place them in a single shape superclass. Then, using variables of the superclass type, we can manipulate shape objects polymorphically. Removing the redundant code will result in a smaller, more flexible program that’s easier to maintain.
10.1 Modify the MyLine, MyOval and MyRectangle classes of GUI and Graphics Case Study Exercise 8.2 to create the class hierarchy in Fig. 10.16. Classes of ...
Read now
Unlock full access