demo_constructor_assemble_2.cpp
来自「对于一个初涉VC++的人来书」· C++ 代码 · 共 66 行
CPP
66 行
//***************************************************
# include <iostream.h>
class Student
{
public:
Student()
{
cout<<"constructing student."<<endl;
semesHours=100;
gpa=3.5;
}
~Student()
{
cout<<"deconstructing student."<<endl;
}
protected:
int semesHours;
float gpa;
};
class Teacher
{
public:
Teacher()
{
cout<<"constructing teacher."<<endl;
}
~Teacher()
{
cout<<"deconstructing teacher."<<endl;
}
};
class TutorPair
{
public:
TutorPair()
{
cout<<"constructing tutorpair."<<endl;
noMeetings=0;
}
~TutorPair()
{
cout<<"deconstructing tutorpair."<<endl;
}
protected:
Student student;
Teacher teacher;
int noMeetings;
};
void main()
{
TutorPair tp;
cout<<"back in main."<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?