cppquester said:
Although I am pretty sure this is true:
Is it guaranteed, that the size (from sizeof operator) of a derived
class is always at least as large as the base class?
I don't know what the standard says, so this is complete speculation.
However, I would imagine that it makes no such guarantee.
A plausible (but in practice completely hypothetical) situation where
the derived class might actually be smaller than the base class is when
so-called empty base class optimization is in play. If the compiler
decides that the size of an empty class is, let's say, 4 bytes, while
the size of a class containing one char is 1 byte, you could stumble
across this very situation, if the latter is derived from the former.
I'm pretty certain this will never happen in practice, though.