Sunday, May 23, 2010

How to create class and constructor using VBScript

Class sampleClass
Private str

Private sub Class_Initialize()
msgbox("I am constructor")
End Sub

Private sub Class_Terminate()
msgbox("I am destructor")
End Sub

Public function setString(strVar)
str=strVar
End Function

Public function getString()
getString=str
End Function
End Class

Set strObj= New sampleClass
strObj.setString("Uday")
temp=strObj.getString
msgbox(temp)

No comments: