Expressing Inheritance With A UML Class Diagram

 < 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.

click to expand
Figure 13-1: UML Class Diagram Showing Generalization

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 > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net