C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
| < Day Day Up > |
|
The UML class diagram can be extended to show class generalization. An association line tipped with an open arrowhead is drawn from the subclass to the base class. Figure 13-1 shows a class diagram for two classes named BaseClass and DerivedClassOne. These classes will be used in the next several sections to demonstrate some of the features associated with inheritance.
BaseClass is referred to as the base class and DerivedClassOne is referred to as the derived class or subclass. Since DerivedClassOne directly inherits from BaseClass, BaseClass can also be referred to as a direct base class.
BaseClass contains two private attributes. One is a static, class-wide variable named count, and the other is an integer variable named its_count. BaseClass contains four public functions and one protected function. You will soon see how protected members are treated in an inheritance relationship. DerivedClassOne has its own set of private attributes with the same names as the ones found in BaseClass. DerivedClassOne has four public interface functions that provide basic functionality.
| < Day Day Up > |
|