Well "any pointers" is actually the right guess. Every polymorphic class stores some additional "hidden" information in addition to explicitly declared data fields. In a typical implementation it will store a pointer to so called Virtual Method Table (VMT). The size of that pointer is exactly what contributes extra bytes to the size of the class in your case.
Apparently you are compiling your code on a 64-but platform, which uses 8-byte pointers. So the total size of your class is 8 for VMT pointer, 4 for your int a
field and 4 more padding bytes to align the class size to 8-byte boundary. If you compile your code in 32-bit mode, the sizeof
for this class will probably evaluate to 8.
In single-inheritance hierarchy all classes will typically "share" the pointer introduced by the topmost polymorphic class in the hierarchy, meaning that the size of any polymorphic class grows by size of a single pointer. But in multiple-inheritance hierarchy it is possible to end up with multiple hidden VMT pointers inside a single class, meaning that the size of such class will grow by size of a multiple pointers.