05_05.cpp

来自「一些C++的课件和实验源代码」· C++ 代码 · 共 52 行

CPP
52
字号
// 05_05.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <conio.h>

class A{};

class B{ int x; };

class C{ 
	static int x;	B  b;   
};

class D{   
	int x;
	C   c;
	D();
	~D();
};

class E{
	int x;
	C   c;
	E();
	virtual ~E();
};

class F{
	char  char1;
	short short1;
	C c1;
	char  char2;
	C c2;
	short short2;
	C c3;
	short short3;
};

int main(int argc, char* argv[])
{
	printf("\n sizeof(A) = %d", sizeof(A));
	printf("\n sizeof(B) = %d", sizeof(B));
	printf("\n sizeof(C) = %d", sizeof(C));
	printf("\n sizeof(D) = %d", sizeof(D));
	printf("\n sizeof(E) = %d", sizeof(E));
	printf("\n sizeof(F) = %d", sizeof(F));

	getch();
	return 0;
}

⌨️ 快捷键说明

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