1.

Abstract class A has 4 virtual functions. Abstract class B defines only 2 of those member functions as it extends class A. Class C extends class B and implements the other two member functions of class A. Choose the correct option below.(a) Program won’t run as all the methods are not defined by B(b) Program won’t run as C is not inheriting A directly(c) Program won’t run as multiple inheritance is used(d) Program runs correctlyThis question was posed to me in my homework.This key question is from Abstract Class topic in section Classes of Object Oriented Programming

Answer» CORRECT answer is (d) Program runs correctly

Easiest explanation - The program runs correctly. This is because even CLASS B is abstract so it’s not mandatory to define all the VIRTUAL functions. Class C is not abstract but all the virtual functions have been IMPLEMENTED will that class.


Discussion

No Comment Found

Related InterviewSolutions