#include<iostream>
using namespace std;
class Base1
{
public:
int m_A = 10;//4字节
};
class Base2
{
public:
int m_A = 20;//4字节
};
class Son :public Base1, public Base2
{
public:
int m_C = 30;//4字节
};
void test()
{
Son son;
//当我们父类中出现同名成员后,要加作用域,一般不建议用多继承。
cout <<"Base1中的m_A:" << son.Base1::m_A << endl;
cout << "Base2中的m_A:" << son.Base2::m_A << endl;
cout << "Son的大小为:" << sizeof(son) << endl;//12字节
}
int main()
{
test();
system("pause");
return 0;
}