What is the effect of writing override after a member function declaration?
-
A
The function is inlined at every call site
-
B
The compiler verifies it overrides a base method
Correct answer
-
C
The base version is removed from the vtable
-
D
Subclasses may no longer override it
Correct answer
B. The compiler verifies it overrides a base method
15 views
Explanation
override makes the compiler reject the declaration if no matching virtual base function exists.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ