Overriding Members
When a class derives from another one, it inherits members and the members behave as they are defined in the base class. (For this purpose, remember the scope.) As for other .NET languages, Visual Basic enables redefining inherited methods and properties so that you can change their behavior. This technique is known as overriding and requires a little work on both the base class and the derived class. If you want to provide the ability of overriding a member, in the base class you have to mark the member as Overridable
. Let’s continue the example of the Person
class, defined as follows:
Public Class Person Public Property FirstName As String Public Property LastName As String 'Simplified ...
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.