CS Electrical And Electronics
@cselectricalandelectronics

What is ambiguity in inheritance?

All QuestionsCategory: Cpp LanguageWhat is ambiguity in inheritance?
CS Electrical And Electronics Staff asked 4 years ago

I need short information.

1 Answers
CS Electrical And Electronics Staff answered 4 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