第4版,p59,例8
#include<iostream>
using namespace std;
class Base
{
public:
Base(){cout<<"..."<<endl}
~Base(){}
virtual void f(int){}
virtual void f(double){}
virtual void g(int i=10){}
...
}
class Derived:public Base
{
...
}
int main ()
{
Base b;
Derived d;
Base *pb=new Derived;
cout <<sizeof(Base)<<endl;
cout <<sizeof(Derived)<<endl;
return 0;
}
为什么输出是4 4?