Why is the sizeof(objDrive) being indicated as 12 ?Code:#include <iostream> using namespace std; class Base1 { public: virtual void f() { } }; class Base2 { public: virtual void f() { } }; class Base3 { public: virtual void f() { } }; class Drive : public Base1, public Base2, public Base3 { }; int main() { Drive objDrive; cout << "Size is = " << sizeof(objDrive) << endl; return 0; }
I understand that :
4 bytes for virtual fptr table for Base 1, 4 bytes for virtual fptr table for Base 2,4 bytes for virtual fptr table for Base 3.
What about 4 bytes for virtual fptr table for Drive ?




Reply With Quote