2013???????????--???е??????????
???????????? ???????[ 2013/1/18 10:46:21 ] ????????????
??????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; //
}
?????????????????????
???????о?????????????????沼??ɡ?
?????????????vbtable????????????????A??B????????4??ClassA???????????ClassB???????????????????classB????????????????????????A??????Class C??Class D?????????????????????ClassC????????棬ClassC???????????D??????????????????????????????ClassD????????????8???????????????????????????????????????????????????4bytes???????????????????????????????????ó?????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11