MyBase
MyBase 關鍵字的行為類似於引用類的當前例項的基類的物件變數。
Public Class Person
Public Sub DoSomething()
Console.WriteLine("Person")
End Sub
End Class
Public Class Customer
Inherits Person
Public Sub DoSomethingElse()
MyBase.DoSomething()
End Sub
End Class
用法示例:
Dim p As New Person
p.DoSomething()
Console.WriteLine("----")
Dim c As New Customer
c.DoSomething()
c.DoSomethingElse()
輸出:
PersonPerson
Person