next up previous
Next: Containment relationship Up: Specify Dependencies Previous: Specify Dependencies

Inheritance relationship

Inheritance is the higher level relationship that can be represented directly in C++ and the one that figures largest in the early stages of a design. In practice inheritace is appearing in two forms.

We express inheritance relationship in C++ in the following way:

class base1 { /* ... */ };
class base2 { /* ... */ };
class base3 { /* ... */ };

class derived : public base1, protected base2, private base3 { /* ... */ };

Of cource the derived class depends on its base classes. It is less often appreciated that if a class has a virtual function, the class depends on the derived classes. Similarly, if a class uses a protected member, that is again a dependency from the derived classes. Try to minimalize such dependencies.



Porkoláb Zoltán 2001-09-03