Tree Diagrams

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Chapter 7.  Inheritance


Inheritance relationships are usually displayed graphically in a tree diagram (see Figure 7.1).

Figure 7.1. Car tree diagram.

graphics/07fig01.gif

Figure 7.1 shows that the root of all the classes, or the top-level super class, is Car. The Car has three subclasses: Porsche, Pinto, and Corvette. In this tree, the Pinto and Corvette do not have any subclasses and are referred to as leafs of the tree. The Porsche has two subclasses: 911 and 944. To these subclasses, the Porsche is the super class thus, the Porsche is a subclass of Car and a super class to 911 and 944. Finally, the TwinTurbo class is a subclass of 911.

These diagrams will greatly help you understand the relationships between your classes.


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

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