The Shadows keyword indicates that a declared programming element shadows, or hides, an identically named element, or set of overloaded elements, in a base class. You can shadow any kind of declared element with any other kind.
A shadowed element is normally unavailable from within the derived class that shadows it. However, the following considerations apply:
- If the shadowing element is not accessible from the code referring to it, for example if it is Private, the reference is resolved to the shadowed element.
- If you shadow an element, you can still access the shadowed element through an object declared with the type of the base class.
The purpose of shadowing is to protect the definition of your class members. The base class might undergo a change that creates an element with the same name as one you have already defined. If this happens, the Shadows keyword forces references through your class to be resolved to your previously defined member, instead of to the new base class element.
The Shadows keyword is used in these contexts: