O'Reilly logo

Visual Basic® .NET by Example by Bob Donald, Gabriel Oancea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required