I have a function that takes a class as input parameter and then instantiates it.
It looks kind of like this:
class SomeClass {}
class OtherClass {
function startHere() {
doSomething( SomeClass );
}
function doSomething( myClass ) {
var c = new myClass();
}
}
This works fine, but I am wondering how it works exactly. What type is the parameter of doSomething()? In the language reference I could not find any type that represents a class.
Is there a way to at compile time restrict the class passed in to certain types (e.g. all classes extending a certain base class)? I know I could use instanceof at runtime, but would prefer compile time.





