Class_Initialize doesn't take parameters. You can add a custom
Init/Start routine to your class, which accepts the parameters you want
to use. Then you can instantiate the class, and call the custom routine
in one line, like this:
Class MyClass
Private a, b, c
Public Sub Init(x, y, z)
a = x
b = y
c = z
End Sub
End Class
Set myObject = (New MyClass).Init(1, 2, 3)
The wiki article "Using Class Based Event Handlers
<http://www.gwmicro.com/mediawiki/index.php/Using_Class_Based_Event_Handlers>"
demonstrates this practice.
Aaron
On 4/30/2012 1:20 PM, David Helkenn wrote:
Hello,
Does VB Script support a way to parameterize a class? In some
languages, it is possible to define a 'virtual' or 'generic' class,
such that when it is instantiated, the developer supplies the required
parameters. For example, a virtual stack may be one number deep in one
instance and another depth in a second instance. Or, the contents of
the stack may be trucks in one, cows in a second, or temperatures in a
third. In other words, it might be possible to define stacks of
differing depths, differing objects, or both. For example, supply the
required parameters and one could get a stack of up to 8 cows, etc.
I'm not finding any way to have half a dozen 'stacks' for my data
objects -- one stack of four, another of 13, and the rest with 22.
Thanks for any help with this one!
Dave
--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.