ch12_3.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:
C#编程
开发平台:
Visual C++
- //**********************
- //** ch12_3.cpp **
- //**********************
- #include <iostream.h>
- class Student{
- public:
- Student()
- {
- cout <<"constructing student.n";
- semesHours=100;
- gpa=3.5;
- }
- ~Student()
- {
- cout <<"destructing student.n";
- }
- //其他公共成员
- protected:
- int semesHours;
- float gpa;
- };
- class Teacher{
- public:
- Teacher()
- {
- cout <<"constructing teacher.n";
- }
- ~Teacher()
- {
- cout <<"destructing teacher.n";
- }
- };
- class TutorPair{
- public:
- TutorPair()
- {
- cout <<"constructing tutorpair.n";
- noMeetings=0;
- }
- ~TutorPair()
- {
- cout <<"destructing tutorpair.n";
- }
- protected:
- Student student;
- Teacher teacher;
- int noMeetings;
- };
- void main()
- {
- TutorPair tp;
- cout <<"back in main.n";
- }