C++ - Ambiguity in Multiple inheritance - Ambiguity in Multiple inheritance

Ambiguity in Multiple inheritance

When you derive classes, ambiguities can result if base and derived classes have members with the same names. Access to a base class member is ambiguous if you use a name or qualified name that does not refer to a unique function or object.

                class A(Grande Father)
                    /                            \
                  /   				    \
 (Father)class B                   class C (uncle)
		\				     /
  		   \                               /
                        _     class D _   (child class)

Here if suppose child class inherited class B and class C and suppose class D has call any function that is already present in both the base class at the compilation time child class object will be confused that from which class that function should be called.

class Base1{
		void same_function(){


class Base2{
		void same_function(){


class Derived : public Base1,public Base2{


void main(){
Derived obj;
Error : Because compiler can’t figure out which is called.
Solution for it
void main()