1. 11.3 (Composition as an Alternative to Inheritance) Many programs written with inheritance can be written with composition instead, and vice versa. Rewrite class BasePlusCommissionEmployee of the CommissionEmployeeBasePlusCommissionEmployee hierarchy to use composition rather than inheritance. After you do this, assess the relative merits of the two approaches for designing classes CommissionEmployee and BasePlusCommissionEmployee, as well as for object-oriented programs in general. Which approach is more natural? Why?

  2. 11.4 (Inheritance Advantage) Discuss the ways in which inheritance saves time during program development and helps prevent errors.

  3. 11.5 (Protected vs. Private Base Classes) Some programmers prefer not to use ...

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.