1.

Which type of inheritance leads to diamond problem?(a) Single level(b) Multi-level(c) Multiple(d) HierarchicalI have been asked this question during an interview.Origin of the question is Inheritance topic in portion Inheritance & its Types of Object Oriented Programming

Answer»

The correct answer is (c) Multiple

Best EXPLANATION: When 2 or more classes inherit the same class using multiple inheritance and then ONE more class inherits those two base classes, we get a diamond like structure. Here, ambiguity ARISES when same FUNCTION gets derived into 2 base classes and finally to 3rd level class because same NAME functions are being inherited.



Discussion

No Comment Found

Related InterviewSolutions