将VB中的CLASS结合到VBscript中来

发表于:2007-06-30来源:作者:点击数: 标签:
SCRIPT LANGUAGE= vb script RUNAT=Server Class clsTest Private m_strTest Private Sub Class_Initialize() m_strTest = VB Script Programming is fun! End Sub Private Function PrivateTest(strTest) PrivateTest = strReverse(strTest) End Function Pu
<SCRIPT LANGUAGE=vbscript RUNAT=Server>
Class clsTest
Private m_strTest

Private Sub Class_Initialize()
m_strTest = "VBScript Programming is fun!"
End Sub

Private Function PrivateTest(strTest)
PrivateTest = strReverse(strTest)
End Function

Public Property Get TestProperty()
TestProperty = m_strTest
End Property

Public Property Let TestProperty(strTest)
m_strTest = strTest
End Property

Public Sub Test()
m_strTest = PrivateTest(m_strTest)
End Sub
End Class

Dim objTest
Set objTest = New clsTest

Response.Write objTest.TestProperty & "<BR>"
objTest.Test
Response.Write objTest.TestProperty & "<BR>"
objTest.TestProperty = "Objects are cool!"
Response.Write objTest.TestProperty & "<BR>"
objTest.Test
Response.Write objTest.TestProperty & "<BR>"

Set objTest = Nothing
</SCRIPT>

原文转自:http://www.ltesting.net