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); }
public void clearInstance() { spaceship = null; }