Employee (Figs. 12.9–12.10, discussed in further detail shortly) provides functions
Employee’s data members. An
earnings function certainly applies generally to all employees, but each earnings calculation depends on the employee’s class. So we declare
earnings as pure
virtual in base class
Employee because a default implementation does not make sense for that function—there is not enough information to determine what amount
earnings should return. Each derived class overrides
earnings with an appropriate implementation. To calculate an employee’s earnings, the program assigns the address of an employee’s object ...