??????vs2010????????????????????????????vbtable???????????????С??16bytes??a??class A????????b??classB????????????????????????20bytes??????????????????16?????20bytes?????16??????????b?????????4bytes??C????????????????????????????????16??????D??vbtable?????????????λ??Class D??????б???????4bytes????????sizeof E???С??????vbtable???4bytes) +????????a??b??8bytes??+ C ??4bytes?????е???????????????????????????????????

????????????


class A
{
};
class B
{
    int b;
};

class C
{
};
class D
{
};
class E: public virtual A ?? public virtual B ?? public virtual C ?? public virtual D
{
};
void main()
{
   cout<<"sizeof A: "<<sizeof(A)<<endl;
   cout<<"sizeof B: "<<sizeof(B)<<endl;
   cout<<"sizeof C: "<<sizeof(C)<<endl;
   cout<<"sizeof D: "<<sizeof(D)<<endl;
   cout<<"sizeof E: "<<sizeof(E)<<endl; &nbsp; &nbsp; &nbsp;//&nbsp;
}
 


?????????????????????

???????о?????????????????沼??ɡ?

?????????????vbtable????????????????A??B????????4??ClassA???????????ClassB???????????????????classB????????????????????????A??????Class C??Class D?????????????????????ClassC????????棬ClassC???????????D??????????????????????????????ClassD????????????8???????????????????????????????????????????????????4bytes???????????????????????????????????ó?????????????????????????????