父类中所有得非静态成员都会被子类继承下来,私有成员只是被编译器给隐藏了
#include<iostream>
using namespace std;
class Base
{
public:
int m_A;
protected:
int m_B;
private:
int m_C;
};
class Son :public Base
{
public:
int m_D;
};
void test()
{
cout << "size of Son = " << sizeof(Son) << endl;
}
int main()
{
test();
system("pause");
return 0;
}
分布