Technically, C++11 does not behave much differently from Java here (which is a typical example for one of the "other higher level languages" which you mention). A wrong override
will be a compilation error, just like a wrong @Override
in Java. A missing override
will not be a compilation error, just like a missing @Override
will not be a compilation error in Java.
The only real difference I can see is that Java tools have traditionally had better support to detect a missing @Override
, and that Java users are traditionally encouraged to treat the corresponding warning as an error, whereas C++ compilers have been quite slow so far at adding warning options for missing override
s.
But we're getting there; Clang now has -Winconsistent-missing-override
, and newer GCCs have -Wsuggest-override
. All you have to do is enable those warnings and treat them as errors, either forcibly by the compiler or simply by convention.
As for why it's not simply a keyword: backward compatibility with older code.