示例#1
0
 public static SpaceShip Instance(string nameOfShip)
 {
     if (spaceship == null)
     {
         if (nameOfShip == "Interpid")
         {
             spaceship = new Interpid();
         }
         else if (nameOfShip == "Enterprise")
         {
             spaceship = new Enterprise();
         }
         else if (nameOfShip == "Pegasus")
         {
             spaceship = new Pegasus();
         }
         wichShip = nameOfShip;
     }
     return(spaceship);
 }
示例#2
0
 public void clearInstance()
 {
     spaceship = null;
 }