home *** CD-ROM | disk | FTP | other *** search
/ C++ for Dummies (3rd Edition) / C_FD.iso / CHAP10 / CHAP10_1.CPP next >
C/C++ Source or Header  |  1996-09-02  |  671b  |  49 lines

  1. // Chap10_1.cpp
  2. #include <iostream.h>
  3. class Student
  4. {
  5.   public:
  6.    Student()
  7.    {
  8.       cout << "constructing student\n";
  9.       semesterHours = 0;
  10.       gpa = 0.0;
  11.    }
  12.    //...other public members...
  13.  
  14.   protected:
  15.    int   semesterHours;
  16.    float gpa;
  17. };
  18.  
  19. class Teacher
  20. {
  21.   public:
  22.    Teacher()
  23.    {
  24.       cout << "constructing teacher\n";
  25.    }
  26. };
  27.  
  28. class TutorPair
  29. {
  30.   public:
  31.    TutorPair()
  32.    {
  33.       cout << "constructing tutor pair\n";
  34.       noMeetings = 0;
  35.    }
  36.  
  37.   protected:
  38.    Student student;
  39.    Teacher teacher;
  40.    int     noMeetings;
  41. };
  42.  
  43. int main()
  44. {
  45.    TutorPair tp;
  46.    cout << "back in main\n";
  47.    return 0;
  48. }
  49.