Home Segments Top Top Previous Next

257: Mainline

Usually, it is a good idea to draw a class-hierarchy diagram, such as the following, to see how your classes fit together:

*-----------------------------------------* 
| Attraction:                             | 
|  minutes                                | 
*-----------------------------------------* 
  ^                      ^ 
  |                      | 
  | Superclass           | Superclass 
  |                      | 
  |                      | 
*-------------------* *-------------------* 
| Movie:            | | Symphony:         | 
|  script           | |  music            | 
|  acting           | |  playing          | 
|  direction        | |  conducting       | 
|  rating method    | |  rating method    | 
*-------------------* *-------------------* 

Such a class-hierarchy diagram helps you to see how to distribute instance variables and instance methods among the classes in the hierarchy.