01: #include <string>
02: #include <iostream>
04: using namespace std;
05: 
06: #include "ccc_empl.h"
08: /**
09:    A department in an organization.
10: */
11: class Department {
13: public:
14:    Department(string n);
15:    void set_receptionist(Employee* e);
16:    void set_secretary(Employee* e);
17:    void print() const;
18: private:
19:    string name;
20:    Employee* receptionist;
21:    Employee* secretary;
22: };
24: /**
25:    Constructs a department with a given name.
26:    @param n the department name
27: */
28: Department::Department(string n)
29: {  name = n;
31:    receptionist = NULL;
32:    secretary = NULL;
33: }
35: /**
36:    Sets the receptionist for this department.
37:    @param e the receptionist
38: */
39: void Department::set_receptionist(Employee* e)
40: { receptionist = e; }
44: /**
45:    Sets the secretary for this department.
46:    @param e the secretary
47: */
48: void Department::set_secretary(Employee* e)
49: { secretary = e; }
53: /**
54:    Prints a description of this department.
55: */
56: void Department::print() const
57: {  cout << "Name: " << name << "\n"
59:         << "Receptionist: ";
60:    if (receptionist == NULL) cout << "None";
62:    else
63:       cout << receptionist->get_name() << " "
64:            << receptionist->get_salary();
65:    cout << "\nSecretary: ";
66:    if (secretary == NULL) cout << "None";
68:    else if (secretary == receptionist) cout << "Same";
70:    else cout << secretary->get_name() << " "
72:              << secretary->get_salary();      
73: cout << "\n"; 74: } 75: 76: int main() 77: { Department shipping("Shipping"); 79: Department qc("Quality Control"); 80: Employee* harry = new Employee("Hacker, Harry", 45000); 81: shipping.set_secretary(harry); 82: Employee* tina = new Employee("Tester, Tina", 50000); 83: qc.set_receptionist(tina); 84: qc.set_secretary(tina); 85: tina->set_salary(55000); 86: shipping.print(); 87: qc.print(); 88: 89: return 0; 90: }