Can I create a class from a variable?
Hi:
I have a variable, RptName.
I've got a slew of classes that represent reports, such as:
RptCAMainSum
RptTPEMainSum
etc.
If the value of RptName = "RptCAMainSum" then I want the class:
RptCAMainSum
If the value of RptName = "RptTPEMainSum" the I want the class:
RptTPEMainSum
Of course I could use a long if() else if() block but if I can, I'd rather find a way to call the class from the value of the var.
Something like:
IReport oReport = Class(RptName);
In Javascript I could say:
var oReport = eval(RptName);
this would return the object named whatever the value of RptName is.
I hope that makes sense.
Is there any way to do this?
|