//从父类继承过来的成员,哪些属于子类对象中
//结论:父类中的私有成员也是被子类继承下去了,只是由编译器给隐藏后访问不到
#include "pch.h"
#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 test01() {
cout << "size of son =" << sizeof(son) << endl;//=16,在父类中所有的非静态成员属性都会被子类继承下去,但父类中的私有成员,是被编译器给隐藏了,
//因此访问不到,但是确实继承下去了
}
int main()
{
test01();
}