Declaring a function virtual in C++ enables:
-
A
multiple inheritance of data
-
B
automatic memory management
-
C
runtime polymorphism
Correct answer
-
D
compile-time polymorphism
Correct answer
C. runtime polymorphism
12 views
Explanation
Virtual functions allow the correct overriding function to be chosen at run time through a base-class pointer.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ