Your decision to use `override` should not be influenced by the kind of
file – whether header or implementation file like cpp.
The kind of file plays a rôle for the compiler's assumption of what
programming language the code is written in, and it plays a rôle for
your assumption about how the file will be used, e.g. that a header file
will be included and an implementation file used as the main code file
for a translation unit.
The by convention different usage means that one adopts some different
conventions in header files versus implementation files, e.g. for
include guards, use of `inline`, definitions of namespace scope
variables. But this does not extend to use of `override` or not. There
is no way that the different usage of different file types is related to
what `override` is about.
`override` is a safeguard against believing one overrides a base class'
member function that isn't there or isn't virtual, and it's a safeguard
against maintenance changing the signature of an overridden function,
e.g. by adding a defaulted argument. So, it's effectively a part of the
static type checking, even though it doesn't influence the type.
Essentially it says to the compiler, “this is what I intend, namely an
override, please check that for me”, and clearly that has nothing to do
with file types whatsoever.
The cost is mainly that the syntax is awkward, with `override` at the
end of the function head. That can present a formatting problem. But
it's IMO a very small problem, and the safety is well worth it.
Cheers & hth.,
- Alf