C ++ 11 almost had what you want.
The override keyword was originally part of a larger sentence ( N2928 ), which also included the ability to enforce its use:
class A { virtual void f(); }; class B [[base_check]] : public A { void f();
The base_check attribute will make an error to override a virtual function without using the override keyword.
There was also a hiding attribute that says a function hides functions in a base class. If base_check used, and the function hides one of the base class without using hiding , this is an error.
But most of the sentence was dropped, and only the final and override functions were saved as "identifiers with a special value", not attributes.
Jonathan Wakely Nov 04 2018-12-12T00: 00Z
source share