JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the MyBase Keyword

You can use the MyBase keyword to access methods in a base class when overriding methods in a derived class. For example, suppose you are designing a derived class that overrides a method inherited from the base class; in this case, the overridden method can call the original method in the base class using MyBase. We've already seen this at work in the Inheritance example on the CD-ROM, as discussed in the In Depth section of this chapter, where I'm calling a base class's constructor from a derived class:

    Public Sub New(ByVal form1 As Form1)
    End Sub

Note that MyBase is a keyword and not an object, so you can't assign it to a variable. And, of course, you can't use it to access private members of a base class. Nor can you use MyBase in modules.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor