Overriding Shared Members

Shared members cannot be overridden. This means that you can only use them as they have been inherited from the base class or provide a shadowing implementation for creating a new definition from scratch. For example, consider this simplified implementation of the Person class, which exposes a shared Counter property:

image

If you now create a Contact class that inherits from Person, you can use the Counter property as previously implemented, or you can shadow the base definition as follows:

image

If you intend to provide an overloaded ...

Get Visual Basic® 2010 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.