1.

Which is the correct condition for function overriding?(a) The declaration must not be same in base and derived class(b) The declaration must be exactly the same in base and derived class(c) The declaration should have at least 1 same argument in declaration of base and derived class(d) The declaration should have at least 1 different argument in declaration of base and derived classI had been asked this question in final exam.My question is based upon Overriding Member Functions topic in section Member Functions & its Types of Object Oriented Programming

Answer»

Correct option is (b) The declaration MUST be exactly the same in base and derived class

Best explanation: For a FUNCTION to be over ridden, the declaration must be exactly the same. There must not be any DIFFERENT syntax used. This will ensure that the function to be OVERRIDDEN is only the ONE intended from to be overridden from the derived class.



Discussion

No Comment Found

Related InterviewSolutions