Practice mode C++

What does the override specifier on a member function tell the C++ compiler?

Correct answer D. That the function must override a base class virtual function, or compilation fails

Explanation

override, added in C++11, states the intent to override a virtual function. If no matching virtual function exists in a base class, for example because of a typo, a differing parameter type or a missing const, the program is ill-formed and the compiler reports an error. Preventing further overriding is the job of final, not override.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.