I have many classes and for each class, methods to initialize an instance:
function A() {}
function B() {}
function a(arg) {
return new A(arg);
}
function b(arg) {
return new B(arg);
}
I want to have a single function to initialize one of these classes like this:
function any(AorB) {
return new AorB();
}
How can I do that so the overall code size is small?