1.

Which among the following is correct for abstract methods?(a) It must have different prototype in the derived class(b) It must have same prototype in both base and derived class(c) It must have different signature in derived class(d) It must have same return type onlyI have been asked this question during an interview.My question comes from Abstract Function topic in section Member Functions & its Types of Object Oriented Programming

Answer»

Right OPTION is (b) It MUST have same prototype in both base and derived class

The EXPLANATION is: The prototype must be the same. This is to override the function declared as abstract in base class. Or ELSE it will not be possible to override the abstract function of base class and hence we GET a compile time error.



Discussion

No Comment Found

Related InterviewSolutions