Class baseClass
Public Overridable Sub testMethod()
MsgBox("Base class string")
End Sub
Public Sub useMe()
' The following call uses the calling class's version, even if
' that version is an override.
Me.testMethod()
End Sub
Public Sub useMyClass()
' The following call uses this version and not any override.
MyClass.testMethod()
End Sub
End Class
Class derivedClass : Inherits baseClass
Public Overrides Sub testMethod()
MsgBox("Derived class string")
End Sub
End Class
Class testClasses
Sub startHere()
Dim testObj As derivedClass = New derivedClass()
' The following call displays "Derived class string".
testObj.useMe()
' The following call displays "Base class string".
testObj.useMyClass()
End Sub
End Class
访问基类中的重写过程testMethod时,为什么不用声明
Dim cla1 As New baseClass
cla1.testMethod() 这样直接访问吗
下面这样写过程后再访问testMethod()有什么意义,
为什么要经过useMyClass过程访问testMethod()呢?
Public Sub useMyClass()
' The following call uses this version and not any override.
MyClass.testMethod()
End Sub
------解决方案--------------------
look 一下:
http://bbs.csdn.net/topics/70243992