Reputation: 89
How can you use a variable as a name for a class? I want to make the name of the class flexible.
var number = 1 ;
return MechanikGameStart$number();
Upvotes: 0
Views: 80
Reputation: 4763
if (1 == number) return MechanikGameStart1();
else if (2 == number) return MechanikGameStart2();
// ...
Otherwise it's not possible in Object-oriented programming. Class name must be known and specified in advance
Upvotes: 5