The official term for "overriding" a non-virtual method
I am using the "simulate covariance by casting" method from this answer . But I want to mark Derived :: Clone with comments that make it clear that a method with the same signature and name exists in the base class. I wrote:
/*shadow*/ shared_ptr<Derived> Clone() const
But I'm not sure if the term "shadow" will be universally understood in this context. It appears to be more commonly used for local variables shadowing other local variables.
What's the official term for this kind of thing?
source to share
The standard (N4141) uses the term "hiding" for this, for example
Note. The names declared in
V
and the left instanceW
are hidden inB
, but the names declared in the right instanceW
are not hidden at all. - end of note
10.2 / 11
However, shading is a widely used term for all sorts of name hiding, so it is perfectly fine to use it in a comment.
source to share
I came across two terms used to describe this kind of behavior in a programming language, hiding and shading. I usually say that some function hides another function and that some variable obscures another variable.
by the way. There is an article on Wikipedia called Variable Shading .
I've also heard masking the name of the name, but not as often as hiding or shading.
source to share