VBScript的Me关键字

其他面向对象的编程语言通常使用 this 或者 self 关键字来访问当前对象,而 VBS 使用的是 Me 关键字。Me 关键字代表着类在代码运行时的当前实例(instance),或者说,当前对象(object)。

Class myClass
    Private i_count
    Public Property Get count
        i_count = i_count + 1
        count = i_count
    End Property
    ' 递增
    Public Sub countTwice
	    i_count = Me.count + Me.count
    End Sub
	
    Public Property Let count(c)
        i_count = c
    End Property
End Class

set X = new myClass
X.count = 20
x.countTwice()
MsgBox( X.count )
机器瞎学/数据掩埋/模式混淆/人工智障/深度遗忘/神经掉线/计算机幻觉/专注单身二十五年
原文地址:https://www.cnblogs.com/rubylouvre/p/2970361.html