12.6.3. Creating Concrete Derived Class CommissionEmployee

Class CommissionEmployee (Figs. 12.1312.14) derives from Employee (Fig. 12.13, line 9). The member-function implementations (Fig. 12.14) include a constructor (lines 9–15) that takes a first name, last name, social security number, sales amount and commission rate; set functions (lines 18–24 and 33–39) to assign new values to data members commissionRate and grossSales, respectively; get functions (lines 27–30 and 42–45) that retrieve their values; function earnings (lines 48–51) to calculate a CommissionEmployee’s earnings; and function print (lines 54–60) to output the employee’s type, namely, "commission employee: " and employee-specific information. The constructor passes the first ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.