Ruby's Louvre

每天学习一点点算法

导航

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 )

posted on 2013-03-20 00:38  司徒正美  阅读(848)  评论(0编辑  收藏  举报