Since VBScript 5.0, developers have been able to create classes to use in their scripts—a definite step along the road of object-oriented programming in VBScript. Writing classes with VBScript is very similar to writing COM objects with VB. Before we look at writing an actual class, let’s go over some of the terminology so we are clear on what we are doing and what we are referring to.
A class is simply the template for an object. When you instantiate an object (that is, create an instance of a class) in code, VBScript makes a copy of the class for your use. All objects come from a class. Writing the class is simply a matter of creating a design for the objects that you want to use.
So naturally, it follows that an object is simply a copy of the class that you are making available to your program. You can make as many copies as you like for your use. The copies are temporary structures for holding information or creating interactions. When you are done with the objects, you can release them. If you need another one, you can instantiate another copy.
In VBScript, classes must be created in the scripts where you want to use them or they must be included in the scripts that use them. Since VBScript isn’t compiled, you don’t have the advantage of being able to write a set of VBScript COM classes that are usable outside of the scripts in which they’re defined, or that can be easily accessed by programs and scripts written in other languages.
You declare ...