1.

Which among the following is true?(a) Static member functions can’t be virtual(b) Static member functions can be virtual(c) Static member functions can be declared virtual if it is pure virtual class(d) Static member functions can be used as virtual in JavaThis question was posed to me in final exam.I'm obligated to ask this question of Static Member Functions in chapter Exception Handling & Static Class Members of Object Oriented Programming

Answer»

The correct option is (a) STATIC member FUNCTIONS can’t be virtual

The explanation: The static member functions can’t be virtual. This is a restriction on static member functions, since the definition should not CHANGE or should not be overridden by any other function of derived class. The static MEMBERS must REMAIN same for all the objects.



Discussion

No Comment Found

Related InterviewSolutions