Ambiguity in Multiple Inheritance C++

By Prof. Fazal Rehman Shamil

Ambiguity in Multiple Inheritance in C++ is the most common problems occur when we override the functions and we inherit the classes with multiple inheritance.

For example, if we suppose that two-parent classes have the same function which is not overridden in child class.

If you try to call the function using the object of the child class, then the compiler shows error. This problem occurs due to a reason that compiler doesn’t know anything that which function to be called. For example,

The solution to the problem of Ambiguity in Multiple Inheritance
The best solution is to use the scope resolution operator with the function to specify that which function of which class is being called.
For example, parent1 or parent2.

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.