Sams Teach Yourself C++ in 21 Days

(singke) #1

DAY 16


WEEK 2

Advanced Inheritance


So far, you have worked with single and multiple inheritance to create is-a
relationships.
Today, you will learn


  • What aggregation is and how to model it (the has-a relationship)

  • What delegation is and how to model it

  • How to implement one class in terms of another

  • How to use private inheritance


Aggregation..........................................................................................................


You have seen in previous examples that it is possible for the member data of a
class to contain objects of other class types. This is often called aggregation, or
the has-arelationship.
Free download pdf