Answers to Self-Review Exercises

  1. 11.1

    1. Inheritance.

    2. public, protected.

    3. is-a or inheritance (for public inheritance).

    4. has-a or composition or aggregation.

    5. hierarchical.

    6. public.

    7. private.

    8. multiple inheritance.

    9. constructor.

    10. public, protected.

    11. protected, protected.

  2. 11.2

    1. True.

    2. False. A has-a relationship is implemented via composition. An is-a relationship is implemented via inheritance.

    3. False. This is an example of a has-a relationship. Class Car has an is-a relationship with class Vehicle.

    4. True.

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.