// Employee.hpp
class Employee
{
public:
int GetAge() const;
void SetAge(int age);
int GetYearsOfService() const;
void SetYearsOfService(int years);
int GetSalary() const;
void SetSalary(int salary);
private:
int itsAge;
int itsYearsOfService;
int itsSalary;
};
- The following is one possible solution:
1: // Employee.cpp
2: #include
3: #include “Employee.hpp”
4:
5: int Employee::GetAge() const
6: {
7: return itsAge;
8: }
9: void Employee::SetAge(int age)
10: {
11: itsAge = age;
12: }
13: int Employee::GetYearsOfService() const
14: {
15: return itsYearsOfService;
16: }
17: void Employee::SetYearsOfService(int years)
18: {
19: itsYearsOfService = years;
20: }
21: int Employee::GetSalary()const
22: {
23: return itsSalary;
24: }
25: void Employee::SetSalary(int salary)
26: {
27: itsSalary = salary;
28: }
29:
30: int main()
31: {
32: using namespace std;
33:
830 Appendix D
32 0672327112_app_d.qxd 11/19/04 12:30 PM Page 830