private static Road DecodeName(string roadName) { Road road; if (roadName.StartsWith("M")) { road = new Motorway(roadName); } else if (roadName.StartsWith("A")) { road = new ARoad(roadName); } else { road = new Road(roadName); } return(road); }
public static Road NewRoad(string roadName) { Road road; if (roadName.StartsWith("M")) { road = new Motorway(roadName); } else if (roadName.StartsWith("A")) { road = new ARoad(roadName); } else { road = new Road(roadName); } Roads.Add(road); Save(); return(road); }