1.

Which classes can have vtable?(a) Classes having friend functions(b) Classes having virtual functions(c) Classes having static functions(d) All classes have a vtableThe question was asked in a job interview.Query is from vtable and vptr in chapter Class Hierarchies, Library & Containers of C++

Answer»

Correct CHOICE is (b) Classes having virtual FUNCTIONS

Best explanation: Classes having virtual functions only NEED VTABLE because in those cases only we need to RESOLVE function calls in a dynamic manner.



Discussion

No Comment Found

Related InterviewSolutions