In this section, we use an inheritance hierarchy containing types of employees in a company’s payroll app to discuss the relationship between a base class and its derived classes. In this company, commission employees (who will be represented as objects of a base class) are paid a percentage of their sales, while base-salaried commission employees (who will be represented as objects of a derived class) receive a base salary plus a percentage of their sales.
We divide our discussion of the relationship between commission employees and base-salaried commission employees into five examples:
1. The first creates class
CommissionEmployee, which directly inherits from class
object and declares ...