1.

Why does diamond problem arise due to multiple inheritance?(a) Methods with same name creates ambiguity and conflict(b) Methods inherited from the superclass may conflict(c) Derived class gets overloaded with more than two class methods(d) Derived class can’t distinguish the owner class of any derived methodI had been asked this question by my college professor while I was bunking the class.My question is from Multiple Inheritance in division Inheritance & its Types of Object Oriented Programming

Answer»

Right answer is (a) Methods with same name creates ambiguity and conflict

For EXPLANATION: All the DERIVED classes can distinguish the base CLASS members, but if a method is being inherited to the base classes from another class which again gets inherited into same class (diamond SHAPE), that may CREATE conflict in using the function from two available.



Discussion

No Comment Found

Related InterviewSolutions