Hiding Base Class Members
Sometimes it’s useful to hide a base class member by introducing a member with the same name of a subclass. After all, when defining a subclass, you don’t control the names chosen by the author of the base class. If it turns out the best name for the new member to be introduced on the subclass clashes with a member’s name on the base, hiding can be used. Later, in the section called “Interfaces,” you see how a similar situation can arise when an interface is being implemented.
The following example illustrates what we’re talking about for both instance and static members. Although we’re only showing methods here, the same applies for various other member types:
class Bar{ public void ...
Get C# 5.0 Unleashed 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.