Classes are indicated using bubbles (Figure A.1(a)). A name is required for each class. If the class icon should include attributes or operations they will be separated from the class name by a line.
The relations between classes will be indicated using association arcs (Figure A.1(b)). The following association types exist:
The properties icons (Figure A.1(c)) indicate special types of classes or associations.
The abstract property may be present within a class's diagram indicating an abstract class. Abstract classes cannot be instantiated. Abstract classes define only the interface for some of their methods. The implementation of those methods has to be supplied by a subclass. This is useful for the exploitation of polymorphism (see [Boo94] for a detailed discussion).
The other properties shown in figure A.1(c) indicate special types of associations.
The friend property will not be shown in this example. An explanation along with examples can be found in [Boo94].
Figure A.2 shows a class hierarchy for different transport vehicles. The base of all transport classes is the abstract class Transport. Thus, Transport declares only the methods that have to be implemented by its subclasses. This is indicated using the abstract property.
To count the number of transport vehicles instantiated the transport classes use a class variable for the counter. Whenever a transport class gets instantiated the counter is incremented and whenever a transport class is destroyed the counter is decremented. Hence all transport classes operate on the same Counter class. This is indicated by the static property.
The Car, Ship, and Amphibious Car classes inherit all methods and variables declared and defined by their base class. Since the Car and Ship classes are derived from the Transport class virtually, the Amphibious Car class inherits the methods and variables defined by Transport once only. Without virtual inheritance the Transport class would be allocated twice for the Amphibious Car class and hence the Counter class would be increased twice for Amphibious Car instances which is undesired in this situation.