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

📄 05_04.cpp

📁 一些C++的课件和实验源代码
💻 CPP
字号:
// 05_04.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include "stdio.h"
#include "conio.h"

class A{
public:
	static int count;	// 纪录总的对象个数
	int id;				// 纪录当前对象编号

	A(){  id = ++count;	}
	void show(){
		printf("\nobj%d   id = %d  count = %d",
			id, id, count );
	}
};

int A::count = 0;	// 初始化静态成员

int main(int argc, char* argv[])
{
	A a[3];
	printf("count of class A is %d", A::count);
	for(int i = 0; i < A::count; i++)
		a[i].show();

	getch();
	return 1;
}

⌨️ 快捷键说明

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