What is ambiguity in inheritance?

All QuestionsCategory: Cpp LanguageWhat is ambiguity in inheritance?
Chetan Shidling Staff asked 5 years ago

I need short information.

1 Answers
Chetan Shidling Staff answered 5 years ago

The ambiguity occurs when a function with the same name appears in more than one base class or appears in both base and derived class.

Class M
{
public:
void display() {cout<<“\n class M”;}
};

class N
{
public:
void display() { cout << “\n class N”; }
};
class P : public M, public N