我和 MyClass

使用當前的物件例項。

MyClass 使用呼叫成員的類中的 memberdefinition

Class Person
    Public Overridable Sub DoSomething()
        Console.WriteLine("Person")
    End Sub

    Public Sub useMe()
        Me.DoSomething()
    End Sub

    Public Sub useMyClass()
        MyClass.DoSomething()
    End Sub
End Class

Class Customer
    Inherits Person

    Public Overrides Sub DoSomething()
        Console.WriteLine("Customer")
    End Sub
End Class

用法示例:

Dim c As New Customer
c.useMe()
c.useMyClass()

輸出:

Customer
Person