10 Replies Latest reply on Jul 3, 2006 12:10 PM by =Slayer=

    String in constructor call

    =Slayer=
      I have a variable currentGame which points to a blank Object. A random game is chosen from a pool of many games. I want to then call the right constructor based on the game that was chosen, for example if game1 is chosen, I want my constructor to say currentGame = new game1(); if game 2 was chosen it should be currentGame = new game2();

      Each game takes no arguments in the constructor. I was wondering if it is possible to incorporate a string into the constructor call. If it's not I'll just have to make a very large switch statement... but it's always good to know if there's an easier way =]

      Thanks
      Pem