Dear All
I am writing a sample code which is causing errors...
Anybody knows why it is happening??
The Code is given below..
class A
{ public:
A()
{
cout<<"Its A"<<endl;
};
virtual show()
{
printf("Check");
printf("A");
}
};
class B : virtual public A
{ public:
B()
{
cout<<"Its B"<<endl;
}
//virtual
virtual show()
{
printf("Check");
printf("B");
}
};
class C:virtual public A
{ public:
C()
{
cout<<"Its C"<<endl;
}
virtual show(int x)
{
cout<<"x="<<endl;
printf("C Calling Show function of Class C\n");
printf("Check");
}
};
class D:virtual public B,virtual public C
{
public:
D()
{
cout<<"Its D"<<endl;
}
/*show()
{
printf("Check");
printf("D");
}*/
};
void main()
{
D obj;
obj.show(5);
getch();
}
And the error is..
warning C4250: 'D' : inherits 'B::show' via dominance : see declaration of 'show'
error C2385: 'D::show' is ambiguous
warning C4385: could be the 'show' in base 'B' of class 'D'
warning C4385: or the 'show' in base 'C' of class 'D'
error C2660: 'show' : function does not take 1 parameters