Suppose I have a base class with some member variables and no virtual functions:
class Base {
int member;
};
and a derived class that derives in a non-virtual way from Base
and has no new member variables an again no virtual functions:
class Derived : Base {
};
Obviously sizeof(Derived)
can't be smaller than sizeof(Base)
.
Is sizeof(Derived)
required to be equal to sizeof(Base)
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…