I have a function that takes as parameters 2 instances of a (custom) class. But they can each be one of several classes, and I need to then call another function based on what type they are. I'd 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) {
//treat this case
}
Should I go and define 'classname' in each of my classes, or is there a better way to get the class name of an instance?
I don't know how to get typeof() to return anything other than 'object' for a custom class, maybe it's possible?
EDIT: It would be inconvenient to use the instanceof operator, as each class can be 1 of 6 (currently).