home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch12 / tstemply.cpp < prev    next >
C/C++ Source or Header  |  2005-06-16  |  1KB  |  36 lines

  1. //             tstemply.cpp
  2. //
  3. // Synopsis  - Instantiates an employee and a manager.
  4. //             Prints information about both. Makes the 
  5. //             employee part of the manager's group and
  6. //             gives them both raises.
  7. //
  8. // Objective - To study public inheritance and see the 
  9. //             expanded capabilities of the manager
  10. //             class and code reuse.
  11. //
  12.  
  13. // Include Files
  14. #include <iostream.h>
  15. #include "employee.h"
  16.  
  17. int main()
  18. {
  19.     employee e1( "Sam", 50000, 8 );
  20.     manager m1( "Joan", 72000, 10, 104 );            // Note 1
  21.  
  22.     e1.print();                                      // Note 2
  23.     m1.print();                                      // Note 5
  24.     cout << endl << endl;
  25.  
  26.     m1.set_group( e1 );                              // Note 4
  27.     m1.print();                                      // Note 5
  28.     cout << endl << endl;
  29.  
  30.     e1.salary_set( 58000 );
  31.     m1.salary_set( 80000 );                          // Note 3
  32.     m1.print();                                      // Note 5
  33.  
  34.     return 0;
  35. }
  36.