EmployeeClass

using namespace std; class Employee { public: Employee(string theName, float thePayRate); string getName const; float getPayRate const; void setName(string EmpName); float pay(float hoursWorked) const; private: string name; float payRate; };
 * 1) ifndef _EMPLOYEE_H
 * 2) define _EMPLOYEE_H
 * 3) include
 * 1) endif /* not defined _EMPLOYEE_H */

/* * File: employee.cpp * Author: Robert I. Pitts  * Last Modified: April 8, 2000 * Topic: Introduction to Inheritance in C++ * * * Employee method definitions. */ using namespace std; Employee::Employee(string theName, float thePayRate) { name = theName; payRate = thePayRate; } string Employee::getName const { return name;} void Employee::setName(string EmpName) { name=EmpName;} float Employee::getPayRate const { return payRate;} float Employee::pay(float hoursWorked) const { return hoursWorked * payRate;}
 * 1) include "employee.h"

using namespace std; int main{ Employee empl("John Burke", 25.0); // Assume all employees worked 40 hours this period. cout << "For Employee:" << endl; cout << "Name: " << empl.getName << endl; cout << "Pay: " << empl.pay(40.0) << endl; cout << "Changing the Employee's name..." << endl; empl.setName("Doug Conners"); cout << "New Name: " << empl.getName << endl; cout << endl; return 0;}
 * 1) include
 * 2) include "employee.h"