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, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access