为什么MyClass关键字和Me关键字在类中没有差别呢
这两者各自己的作用是什么
------解决方案--------------------
MyClass会调用虚函数的当前实现,而Me会调用被重写的实现。
如果不是虚函数或者虚函数未被重写,那么这两个关键字没有区别。
------解决方案--------------------
gei 你 一个 示例:
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