我有这个
class Empty {}; // Empty class class Derived : virtual public Empty { char c; };
在我的机器上,sizeof(Derived);是8,为什么?不是1因为它只有1 char吗?
sizeof(Derived);
8
1
char
当我删除虚拟继承时,sizeof(Derived);是1.
c++
c++ ×1