Suppose I have:
struct Foo: public Bar {
....
}
Foo introduces no new member varaibles. Foo only introduces a bunch of member functions & static functions. Does any part of the C++ standard now guarantee me that:
sizeof(Foo) == sizeof(Bar)
?
Thanks!
I could think of at least one scenario where
sizeof(Foo) != sizeof(Bar):Foowill have a vtable pointer whilstBarwouldn’t and the former’s size will be one word bigger thatBar. On 32bit DEBUG MSVC2010:EDIT This holds true for structs as well as classes, I reran the test to confirm that.