Jump to Real's How-to Main page

Create and use a class

[myclass.vbs]

Dim my_howto

' create an VbsHowTo object and init its properties
Set my_howto = new VbsHowTo
my_howto.create "General", _
                "Start a script", _
                "CSCRIPT to start a script in CONSOLE mode" & vbCRLF & _
                "WSCRIPT to start a script in GUI mode"           
my_howto.print
WScript.Quit(0)

' ---------------------------------------
' class definition to represent an VBScript Howto
Class VbsHowTo
 Dim category
 Dim title
 Dim howto

 Sub create(cat, tit, how)
    category = cat
    title = tit
    howto = how
 End Sub

 Sub print()
   WScript.Echo category & " - " & title
   Wscript.Echo howto
 End Sub

End Class
Thanks to E. Girardet for this tip
If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]