The new Modifier

The new modifier hides the specified member of the base class. The new modifier is the default modifier when a member is repeated (with the same signature) in the derived type. However, unless the new keyword is enunciated, a compiler warning is presented to prevent the accidental hiding of a member of the base class. Explicit use of the new keyword avoids the warning. A virtual member and override member are related, which is important to polymorphism. The derived member with the new modifier and the base member are unrelated.

.NET supports hide-by-signature and hide-by-name techniques. C# supports only hide-by-signature, where a single member is hidden using the new modifier. Hide-by-name hides the entire interface of a member, ...

Get Programming Microsoft® Visual C#® 2008: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.