This is a follow-up question to the one I posted yesterday:
sizeof(myobject) not what I have calculated
I create a class and calculate its size using sizeof(myclass)
. The size is 12 bytes. I then add virtual members, and the size goes up to 24 bytes. It appears to be the data packing problem again (since the size of the vtable pointer is only 8 bytes).
So, my quesion is: is it possible to tell the compiler to put the vtable pointer before the other data members so that I can keep that extra 4 bytes of unused space? I know I can order the data members, but can I "order" the vtable pointer?
John