可以用以下代码来模拟:
Class MyClass {
public function MyCLass(...args) {
switch (args.length) {
case 0: constructor1(); return;
case 1: constructor2(args[0]); return;
case 2: constructor3(args[0], args[1]); return;
...
}}
或者:
if(args[0] is String) {
// process as String
} else if (args[0] is Number){
// process as Number
}