我们在用ASP进行开发时会用到简单的OOP类,但是如果有一个像JAVA和PHP的this这样的东西就更好了。
关键字: Me
其他语言使用 this 或者 self 访问当前对象. VBScript的关键字就是: Me。
<%
Class meClass
Private i_count
Public Property Get Count
i_count = i_count + 1
Count = i_count
End Property
Public Property Get countTwice
countTwice = Me.Count + Me.Count
End Property
Public Property Let Count(c)
i_count = c
End Property
End Class
%>
测试一下:
<% Dim meTest Set meTest = New meClass meTest.Count = 10 Response.Write(meTest.countTwice) Set meTest = Nothing %>
显示的值是:23也就是11 + 12。说明每次的Me.count都进行了自我引用。