#include #include #ifndef DMCGRATH_INHER_HPP #define DMCGRATH_INHER_HPP namespace dmcgrath{ class employee{ public: employee(){ setup_employee(0, "", ""); } employee(std::string name, std::string ssn){ setup_employee(0, name, ssn); } employee(int pay_rate, std::string name, std::string ssn){ setup_employee(pay_rate, name, ssn); } double payment(){ return this->pay_rate; } std::string employee_name(){ return this->name; } std::string employee_ssn(){ return this->ssn; } protected: double pay_rate; std::string name; std::string ssn; void setup_employee(int pay_rate, std::string name, std::string ssn){ this->name = name; this->ssn = ssn; this->pay_rate = pay_rate; } }; class hourly_employee : public employee{ public: hourly_employee() : employee(){ this->hours = 0; } hourly_employee(int pay_rate, std::string name, std::string ssn) : employee(pay_rate, name, ssn){ this->hours = 0; } double payment(){ return this->pay_rate * this->hours; } protected: double hours; }; class executive : public employee{ public: executive() : employee(){ this->hours = 0; } executive(int pay_rate, std::string name, std::string ssn) : employee(pay_rate, name, ssn){ this->hours = 0; } double payment(){ return this->pay_rate + this->bonus(); } protected: double bonus(){ return 1500000; } }; class advisor : public executive{ public: advisor() : executive(){ students = new std::set(); } advisor(const advisor &A){ this->pay_rate = A.pay_rate; this->name = A.name; this->ssn = A.ssn; for(std::set::iterator i = A.students->begin(); i != A.students->end(); ++i){ this->students->insert(*i); } } advisor(int pay_rate, std::string name, std::string ssn) : executive(pay_rate, name, ssn){ } double payment(){ return 0; } ~advisor(){ delete(students); } protected: std::set *students; }; }; } #endif