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

📄 demo_constructor_11.cpp

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

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

# include <iostream.h>

class A
{
public:
	A(int j):age(j),num(age+1) //冒号语法
	{
		cout<<"age: "<<age<<endl;
		cout<<"num: "<<num<<endl;
	}
protected:  //类成员以其在类中声明的顺序构造
//	int num,age; //int num; int age; 
	int age,num; //int age; int num;
};

void main()
{
	A sa(15);
}

// 注意变量n的值!
/* //
age: 15
num: -858993459
Press any key to continue

age: 15
num: 16
Press any key to continue
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -