您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes
Introduction
Content
Apply
Reflect
Extend
previous.gif
 (3087 bytes)
next.gif
 (2959 bytes)

 
 
Content Index
Content Page # 4

Inheritance terminology and symbols

The class from which another class inherits is called its direct superclass or base class . A class that does the inheriting is called the subclass or derived class.

The process of inheritances is also called specialization. The UML symbol for inheritance is a large arrow pointing from the subclass to the base class, as shown below:

In UML notation, the figure below shows the notion that the class Car is a subclass of Vehicle .

It is rather unfortunate that there is a lot of terminology associated with the concept of inheritance. Very often there are different terms that mean the same thing. Object-oriented programming is a widely-used, rapidly developing technique, and it is not surprising that the terminology cannot be standardised as fast as the subject develops. 

The relationships between classes can often be expressed more clearly on a diagram than in text. The standard notation for this is called UML (unified modelling language). The full UML specification is very long (currently 645 pages!), but will only require a few symbols for this unit.

The classes are shown as rectangles. There are spaces in each class to write the attributes and operations of that class. Remember, UML is a modelling language, so the use of object-oriented modelling terms such as attribute and operation are used. A Java programmer can take a model expression in UML and implement the model, so that the modelled attributes and operations become appropriate variables and methods.

In the example above there aren't any attributes or operations, so these spaces are blank. The large arrow denotes an inheritance relationship. This can be read as `Car is a subclass of Vehicle', `Car is a type of Vehicle', `Car is a specialization of vehicle' or `Vehicle is a base class for Car'.

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg