Prev | Current Page 83 | Next

Guy Fouch?©, Trey Nash

"Accelerated VB 2008"

The code inside the Main method in the previous example shows how to call the
method both ways.
The topic of interfaces is broad enough to justify devoting an entire chapter to them, which
we do in Chapter 6. However, the information regarding interfaces covered in this section is
enough to facilitate the discussions in the rest of this chapter.
MyBase and MyClass Keywords
When you derive from a class??”a process also referred to as inheritance??”oftentimes you need
to call a method or access a field, property, or method on the base class from within a method
on the derived class. The MyBase keyword exists for this purpose; MyBase is like an object variable
that always refers to the base class from which the current instance class was derived. You
can use the MyBase keyword just like any other instance variable, but you can use it only within
the block of an instance constructor, instance method, or instance property accessor. You cannot
use it in Shared methods because MyBase allows access to base class implementations of an
instance, much like Me allows access to the instance owning the method. Let??™s look at the following
code block:
Public Class A
Private x As Integer
Public Sub New(ByVal var As Integer)
Me.x = var
End Sub
Public Overridable Sub DoSomething()
System.


Pages:
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
dakolen pensjonaty w beskidach katalog stron dieta light szkolenia bhp warszawa