Display 14.3 Interface for the Derived Class HourlyEmployee(2 of 2) class HourlyEmployee public Employee 12 1 public: 4 HourlyEmployee() HourlyEmployee(string theName,string theSsn, 16 double theWageRate,double theHours); 17 void setRate(double newWageRate); 18 double getRate(const; 19 void setHours(double hoursWorked); 20 double getHours()const; You only list the declaration of an 2 void printCheck(); inherited member function if you 22 private: want to change the definition of the 23 double wageRate; function. 24 double hours; 25 3: 26 }//SavitchEmployees 27 #endif //HOURLYEMPLOYEE_H Copyright 2006 Pearson Addison-Wesley.All rights reserved. 14-11
Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 14-11 Display 14.3 Interface for the Derived Class HourlyEmployee (2 of 2)
HourlyEmployee Class Interface Note definition begins same as any other ◆ifndef structure Includes required libraries +Also includes employee.h! ◆And,the heading: class HourlyEmployee public Employee {. Specifies "publicly inherited"from Employee class Copyright 2006 Pearson Addison-Wesley.All rights reserved. 14-12
Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 14-12 HourlyEmployee Class Interface ¨ Note definition begins same as any other ¨ #ifndef structure ¨ Includes required libraries ¨ Also includes employee.h! ¨ And, the heading: class HourlyEmployee : public Employee { . ¨ Specifies "publicly inherited" from Employee class
HourlyEmployee Class Additions ◆ Derived class interface only lists new or "to be redefined"members Since all others inherited are already defined i.e.:"all"employees have ssn,name,etc. ◆HourlyEmployee adds: ◆Constructors wageRate,hours member variables setRate(,getRate(),setHours(),getHours() member functions Copyright006 Pearson Addison-Wesley.All rights reserved. 14-13
Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 14-13 HourlyEmployee Class Additions ¨ Derived class interface only lists new or "to be redefined" members ¨ Since all others inherited are already defined ¨ i.e.: "all" employees have ssn, name, etc. ¨ HourlyEmployee adds: ¨ Constructors ¨ wageRate, hours member variables ¨ setRate(), getRate(), setHours(), getHours() member functions