Abstract Classes

There are some cases in which the base class of an inheritance hierarchy needs to declare an overridable method, but the class itself is unable to provide any implementation for the method. In this case what you need is a way to force the derived classes to override the method in discussion. For an example, let's consider a banking application that has an Account base class, of which you derived two classes: CheckingAccount and SavingsAccount. We illustrate these three classes as follows.

 Public Class Account Protected m_balance As Decimal Public Property balance() As Decimal Get Return m_balance End Get Set m_balance = value End Set End Property Public Sub New(Optional ByVal startBalance As Decimal = 0) m_balance = startBalance ...

Get Visual Basic® .NET by Example 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.