class A
{
public:
int value;
};
class B:virtual public A{};
//如果去掉virtual ,注意下面 main() 中的类的声明,否则会产生二义性
class C:virtual public A {};
//同上
class D: public B,public C
{
public:
int Value()
{return value;}
};
void main()
{
D d;
int v = d.value; // int v = d.B::value;
D * object = new D;
int w = object->value; // int w = object->B::value;
}