What are class hierarchies?
In an object orienetd design, classes of objects are arranged into hierarchies that model and describe relationships among the classes. The simplest relationship is an association. For example, there could be an employment association between a student and a school.
Hierarchies can also be used to build the definitions of individual classes and thus achieve a important aspect o reusability. One way is to include other classes as part of one class. For example, consider a window class. Such a class would contain control objects such as title bar, status bar, menus and scrollbars. Thus, all the different control objects would be parts of the whole window class. This kind of hierarchy is called aggregation or composition.
A second way to use a hierarchy is to define more specialized classes based on a pre-existing generalized class. For example, a dialog class can be considered a specialized case of a more general window class. The more specialized class will automatically share the attributes of the more general class (e.g., size and screen position), and will probably add new attributes and behaviors to the generalized class. This kind of hierarchy is called as Inheritance.
