个人观点,有错误之处,请批评,谢谢.
测试代码如下:
#include <iostream>
#include <typeinfo>
using namespace std;
class A
{
public:
A(){
strcpy(x,"A::x");
}
char x[20];
};
class B
{
public:
B(){
strcpy(x,"B::x");
}
char x[20];
};
class C:
public A,public B
{
public:
C(){
strcpy(x,"C::x");
}
char x[20];
};
int main(){
C c;
cout<<c.A::x<<endl;
cout<<c.B::x<<endl;
cout<<c.x<<endl;
system("pause");
return 0;
}