关于二义性的问题。。
这是课本的例题,但编译时出错了,请各位帮忙更正下。。(本人用的是C++6.0) #include <iostream.h>
class base
{
public:
int x;
};
class A:public base
{
public:
int y;
};
class B:public base
{
public:
int z;
};
class C:public A,public B
{
public:
int s;
}
int main(void)
{
C cc;
// cc.x=1;
cc.B::x=10;
cc.A::x=100;
cout<<cc.B::x<<endl;
cout<<cc.A::x<<endl;
cc.y=20;
cc.z=30;
cc.s=cc.B::x+cc.y+cc.z;
cout<<cc.s<<endl;
return 1;
}