从父类继承过来的成员,哪些属于子类对象中?
1.利用开发人员命令提示工具查看对象模型
2.跳转盘符 F:
3.跳转文件路径 cd 具体路径下
4.查看命名
5.cl /d1 reportSingleClassLayout类名 文件名 (c后是英文,d后是数字)
#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();
system("pause");
return 0;
}