蜗牛1 发表于 2013-10-28 11:46:09

大神救我,帮帮忙

# include<iostream>
using namespace std;
class A
{
public:
void f()
{
cout<<"aaa"<<endl;
}
};
class B:virtual public A
{
public:
void f()
{
cout<<"bbbb"<<endl;
}
};
class C:public B
{
};
class D:virtual public A,public C
{
public:
void g()
{
f();
}
};
int main()
{
D d;
d.f();
return 0;
}   它的值为啥是bbbb而不是aaa,求解答?
页: [1]
查看完整版本: 大神救我,帮帮忙