1.

Which is the correct syntax of declaring a virtual function?(a) virtual int func();(b) virtual int func(){};(c) inline virtual func();(d) inline virtual func(){};The question was posed to me in an online quiz.This intriguing question comes from Inheritance topic in portion Class Hierarchies, Library & Containers of C++

Answer»

The CORRECT answer is (a) virtual int func();

To explain I would say: To MAKE a FUNCTION virtual function we just need to add virtual keyword at the STARTING of the function declaration.



Discussion

No Comment Found

Related InterviewSolutions