
Changes in Object Orientation | 701
What’s New
2002
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Inheritance
VB.NET supports object-oriented inheritance (but not multiple inheritance). This
means that a class can derive from another (base) class, thereby inheriting all of
the properties, methods, events, and other types of the base class. Since .NET
forms are classes, inheritance applies to them as well. This allows new forms to be
created based on existing control-laden forms.
Overloading
VB.NET supports a language feature known as function overloading. Within a
class, a single method can include multiple argument signature variations. That is,
the number and data type of each method argument can vary between the
different versions, despite the method having the same name in each version. The
following declarations are valid in the same class.
Public Overloads Sub OpenFile( )
' ----- Prompt user for file to open, and open it.
End Sub
Public Overloads Sub OpenFile(ByVal fileToOpen As String)
' ----- Open the specified file.
End Sub
Object Creation
VB 6 supports a form of object creation called implicit object creation. If an object
variable is declared using the
New keyword, as in:
Dim obj As New SomeClass
then the object is created the first time it is used in code. More specifically, the
object variable is initially given the value
Nothing ...