A class-member-declaration is permitted to declare a member with the same name or signature as an inherited member. When this occurs, the derived class member is said to hide the base class member. Hiding an inherited member is not considered an error, but it does cause the compiler to issue a warning. To suppress the warning, the declaration of the derived class member can include a new
modifier to indicate that the derived member is intended to hide the base member. This topic is discussed further in §3.5.1.2.
If a new
modifier is included in a declaration that doesn’t hide an inherited member, a warning is issued to that effect. This warning is suppressed by removing the new
modifier.
It is an error to use the new
and override
modifiers in the same declaration.