⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo_constructor_assemble_2.cpp

📁 对于一个初涉VC++的人来书
💻 CPP
字号:

//***************************************************

# 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -