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:

Public Class Person    Public Shared Property Counter As IntegerEnd Class

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:

Public Class Contact    Inherits Person    Public Shared Shadows Property Counter As IntegerEnd Class ...

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