Answers to Self-Review Exercises
-
Inheritance.
public
,protected
.is-a or inheritance (for
public
inheritance).has-a or composition or aggregation.
hierarchical.
public
.private
.multiple inheritance.
constructor.
public
,protected
.protected
,protected
.
-
True.
False. A has-a relationship is implemented via composition. An is-a relationship is implemented via inheritance.
False. This is an example of a has-a relationship. Class
Car
has an is-a relationship with classVehicle
.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.