1 2 3 4 5 6 7 8 9 10 11 12

This whole process can be generalized to libraries of objects, as illustrated in the following relationship diagram.

Each class has all the properties of its base class, plus others that are unique to the object. For example, the objects in the magnitude class share common need for a relational operator for comparison purposes.

Object

IMAGE imgs/lec-1802.gif

Character

Date

Time

Number

IMAGE imgs/lec-1803.gif

Float

FractionInteger

Let us now look at some specifics to explain how Circle inherits the members of Shape, along with its constructors and destructors. The basics:

class Circle: public Shape {
.......
// Circle will be based on Shape };

Typically the derived class declares additional data members and member functions. For example a Circle may need its radius to compute the circumference or area, while this may not be relevant for a general shape.

March 11, 1998

Page 11

C201/TAM