O'Reilly logo

COM+ Programming with Visual Basic by Jose Mojica

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

VB.NET Features

Now that you know the basics of running the VB compiler and the difference between private assemblies and shared assemblies, let’s discuss some of the new features in VB.NET. In many ways, VB.NET is a different language. The language has been extended to have a number of object-oriented features that it did not have before, such as method inheritance, method overloading, and exception handling.

Inheritance

In Chapter 2, you learned the difference between interface inheritance and code inheritance. VB 6 enabled you to do only one type of inheritance—interface inheritance. VB.NET adds support for the second type of inheritance, code inheritance. The way it works is that you first create a base class. In our ongoing example of a banking application, let’s suppose that your design accounted for two main classes: a Checking class and a Savings class. It is likely that these two classes have functionality in common. In fact, a better design may be to create a base class named Account from which these two classes are derived. The following code shows an application that declares three classes: Account, Checking, and Savings. The Checking and Savings classes inherit all their functionality from the Account class:

Public class Account Dim m_Balance As Decimal Public Sub MakeDeposit(ByVal Amount As Decimal) m_Balance += Amount End Sub Public ReadOnly Property Balance( ) As Decimal Get return m_Balance End Get End Property End Class Public Class Checking Inherits Account End ...

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