The size of pointers will vary between machines. For example on my machine, it is 8
.
Size of the classes in case of virtual inheritance
Whenever you have virtual inheritance, the location of the virtual
base subobject with respect to the start of the complete type is
unknown, so an extra pointer is added to the original object to track
where the virtual base is.
Does virtual inheritance increase the size of derived class?
This behavior is completely implementation-specific and there are no
guarantees about what will happen. That said, most compilers implement
virtual inheritance by having a single copy of the base class lying
around, then having each instance of the derived class store a pointer
inside its class body that points to that one unique instance. That
way, if you cast the object to its virtual base, the compiler can emit
code to find out where that object is. On a 32-bit system, this means
that virtual inheritance might increase the size of the object by four
bytes, as you've observed.