class layout basic
#include<iostream> using namespace std; class a{ }aObj; class b{ char x; }bObj; class c{ virtual void foo(){}; char x; }cObj; class d{ void foo(){}; char x; }dObj; class e{ char a; char x; }eObj; class f{ double a; char x; }fObj; class g{ int a; char x; }gObj; class h{ short a; char x; }hObj; class i{ double b; short a; char x; }iObj; class j{ void virtual foo(){}; }jObj; int main(){ cout<<"aObj "<<sizeof(aObj)<<endl; cout<<"bObj "<<sizeof(bObj)<<endl; cout<<"cObj "<<sizeof(cObj)<<endl; cout<<"dObj "<<sizeof(dObj)<<endl; cout<<"fObj "<<sizeof(fObj)<<endl; cout<<"gObj "<<sizeof(gObj)<<endl; cout<<"hObj "<<sizeof(hObj)<<endl; cout<<"iObj "<<sizeof(iObj)<<endl; cout<<"jObj "<<sizeof(jObj)<<endl; return 0; } //aObj 1 //bObj 1 //cObj 16 //dObj 1 //fObj 16 //gObj 8 //hObj 4 //iObj 16 //jObj 8