O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

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

Shadowing of Class Procedures

Visual Basic also provides another way of replacing procedures in a base class with others of the same name in a derived class. This is called member shadowing.

After defining a function in a base class, a function of the same name in a derived class can completely shadow the original, as shown in the following example:

Companion Content

Open the corresponding solution (.sln), which you can find in the \VB 2010 Developer Handbook\Chapter 10\Shadowing01 folder.

Module mdlMain Sub Main() Dim locBaseInstance As New BaseClass Console.WriteLine(locBaseInstance.AFunction().ToString()) locBaseInstance = New DerivedClass Console.WriteLine(locBaseInstance.AFunction().ToString()) Console.WriteLine() Console.WriteLine("Press key ...

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