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 ViewAudi() { Audi audi = new Audi(); audi.View(); }