public void ViewCar(string CarType) { ICar car; switch (CarType) { case "Toyota": car = new Toyota(); car.View(); break; case "BMW": car = new BMW(); car.View(); break; case "Audi": car = new Audi(); car.View(); break; default: Console.WriteLine("Car type not found"); break; } }
public void ViewToyota() { Toyota toyota = new Toyota(); toyota.View(); }