O'Reilly logo

Object Oriented Programming with C++, Second Edition by Sunil Patekar, Mahesh Bhave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.9 RELATIONSHIPS

After studying inheritance in detail, we are in a position to study two cases where two classes are related to each other. It is tempting to call it inheritance relationships. However, it must be noted that this term is not defined in literature. The two relations are termed as “is–a” and “has–a” relationships.

 

images

 

Figure 10.10 Multilevel inheritance with multiple paths

10.9.1 is–a Relationship

Consider a simple example. We may have a base class as vehicle. The classes car and motorcycle may be derived from it. Now the relationship between derived class and base class can best be described as “is–a” relationship. A car is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required