i m having one doubt regarding hybrid inheritance . i m just a beginner so its not clear to me :confused:
DOUBT:
WHY THE FOLLOWING CODE IS GIVING AMBIGUITY ERROR
#include<iostream.h>
class a
{
public:
void f()
{
cout<<"base class\n";
}
};
class b:private a //visibility mode private
{
public:
void f1()
{
cout<<"inheritance\n";
}
};
class c:public a //visibility mode public
{
public:
void f2()
{
cout<<"hybrid\n";
}
};
class d:public b,public c
void main()
{
d w;
w.f(); //giving ambiguity error
}
f():private member of class b
f():public member of class c
as private members are not inheritable therefore there should be no
ambiguity error as class d can access f() through only one available
path that of class c
f()'saccess by w
w(object of class d)--->class c--->class a
please clear my doubt
i shall be highly thankful