O'Reilly logo

C++11 for Programmers, Second Edition by Harvey M. Deitel, Abbey Deitel, Paul J. Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.3.5. CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using private Data

We now reexamine our hierarchy once more, this time using the best software engineering practices. Class CommissionEmployee now declares data members firstName, lastName, socialSecurityNumber, grossSales and commissionRate as private as shown previously in lines 31–36 of Fig. 11.4.

 1   // Fig. 11.14: CommissionEmployee.cpp 2   // Class CommissionEmployee member-function definitions. 3   #include <iostream> 4   #include <stdexcept> 5   #include "CommissionEmployee.h" // CommissionEmployee class definition 6   using namespace std; 7  8   // constructor 9   CommissionEmployee::CommissionEmployee(10      const string &first, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required