I have a function that takes 2 instances of a (custom) class as parameters. But each of them can be one of several classes, and I then need to call another function based on what type they are. I would like to do something like this:
function any_any(inst1, inst2) {
this[inst1.classname + "_" + inst2.classname] (inst1, inst2);
}
function Circle_Line(circle:Circle, line:Line) {
}
Should I go and define a "classname" in each of my classes, or is there a better way to get the instance class name? I don't know how to get typeof () to return anything other than an "object" for a custom class, maybe this is possible?
EDIT: It would be inconvenient to use the instanceof operator, since each class can be 1 out of 6 (currently).
source
share