1.

If a virtual member function is defined ___________(a) It should not contain any body and defined by subclasses(b) It must contain body and overridden by subclasses(c) It must contain body and be overloaded(d) It must not contain any body and should not be derivedThe question was posed to me in homework.This interesting question is from Member Functions topic in portion Class Members & Types of Object Oriented Programming

Answer»

The correct answer is (a) It should not contain any body and DEFINED by subclasses

Explanation: The VIRTUAL functions are defined USING virtual keyword. These are made in order to make all the CLASSES to define them as the class gets inherited. INCREASES code understanding.



Discussion

No Comment Found

Related InterviewSolutions