The sequence of the declaration qualifier that appears before the function name may contain an identifier (for example, the return type of a function). Imagine any existing code had an override return type:
override foo();
Or even a variable called override :
int override;
Introducing a new override keyword will break any existing code that contains an identifier named override because the keywords are reserved.
So instead of entering a new keyword, they entered a contextual keyword: override (as well as final ). A contextual keyword is identified as a keyword by its syntactic position. It is still good to have identifiers called override and final in your program. If these identifiers appear after the argument list in the function declaration, they have special meaning.
So, the reason that it stands after the function arguments is that introducing new keywords will break the old code, and if the compiler sees an override here, they know exactly what this means, since there can be no other identifier.
source share