Friday, December 3, 2010

Class Size

class VFABC : public VFA, VFB {virtual int f() {return 1;}}; is 8 bytes on Solaris.

The derived class (VFABC) and the first base class share the same vptr. This is the first 4 bytes. The second 4 bytes come from the vtpr in VFB.

Reference: http://www.openasthra.com/tutorials/c-advanced-tutorial-lesson-1/

No comments:

Post a Comment