February 2014
Beginner
1248 pages
62h 25m
English
10.1 Modify the MyLine, MyOval and MyRectangle classes of GUI and Graphics Case Study Exercise 8.1 and Exercise 9.1 to create the class hierarchy in Fig. 10.17. Classes of the MyShape hierarchy should be “smart” shape classes that know how to draw themselves (if provided with a Graphics object that tells them where to draw). Once the program creates an object from this hierarchy, it can manipulate it polymorphically for the rest of its lifetime as a MyShape.
Fig. 10.17 | MyShape hierarchy.
In your solution, class MyShape in Fig. 10.17 must be abstract. Since MyShape represents any shape in general, you cannot ...
Read now
Unlock full access