typetoit
asked on
Use a variable for Class Name in Classic ASP
I have several classes [ClassA, ClassB, ClassC]. I want to create an instance of one of the classes but the name of the class is in a variable [myClass]. I am wondering how I would use the variable to make any instance of one of my classes.
For example, I would like to do something like this:
Can this be done?
For example, I would like to do something like this:
Set objClass = New myClass
Can this be done?
ASKER
I want to instantiate a class where the name of the class is stored in a variable.
For example, myClass could be ClassA or ClassB.
Dim myClass, objClass
myClass = "ClassA"
Set objClass = New myClass
In the above example, I want to instantiate ClassA using myClass. Will this work?
For example, myClass could be ClassA or ClassB.
Dim myClass, objClass
myClass = "ClassA"
Set objClass = New myClass
In the above example, I want to instantiate ClassA using myClass. Will this work?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
here's a good read on OOP Programming in ASP