C++ 類的大小

wanpeng029發表於2020-09-26
#include <iostream>
using namespace std;

class A{
	char a;
	public:
		static char b;
};

class B:public A{
	public:
		char a;
		static char b;
};

class C:public B{
	public:
		virtual void fun1();
		virtual void fun2();
};

int main(){
	cout<<sizeof(C)<<endl;
} 

輸出是8

相關文章