1.

The virtual functions must be declared and defined in _____________ class and overridden in ___________ class.(a) Base, base(b) Derived, derived(c) Derived, base(d) Base, derivedThis question was posed to me in an interview.Query is from Virtual Functions topic in chapter Member Functions & its Types of Object Oriented Programming

Answer»

Correct choice is (d) Base, derived

The best I can explain: The virtual FUNCTIONS must be declared and defined in base CLASS. The functions can be REDEFINED in derived class. If redefined in derived class then it OVERRIDES the base class function definition.



Discussion

No Comment Found

Related InterviewSolutions