static void Main(string[] args) { ICarFactory carFactory = new ToyotaFactory(); Car myCar = carFactory.CreateCar(); myCar.Info(); Engine myEngine = carFactory.CreateEngine(); myEngine.GetPower(); Wheels myWheels = carFactory.CreateWheels(); myWheels.GetDiametr(); carFactory = new FordFactory(); myCar = carFactory.CreateCar(); myCar.Info(); myEngine = carFactory.CreateEngine(); myEngine.GetPower(); myWheels = carFactory.CreateWheels(); myWheels.GetDiametr(); carFactory = new MersedesFactory(); myCar = carFactory.CreateCar(); myCar.Info(); myEngine = carFactory.CreateEngine(); myEngine.GetPower(); myWheels = carFactory.CreateWheels(); myWheels.GetDiametr(); Console.ReadKey(); }
static void Main(string[] args) { ICarFactory carFactory = new ToyotaFactory(); Car myCar = carFactory.CreateCar(); myCar.Info(); Engine myEngine = carFactory.CreateEngine(); myEngine.GetPower(); carFactory = new FordFactory(); myCar = carFactory.CreateCar(); myCar.Info(); myEngine = carFactory.CreateEngine(); myEngine.GetPower(); Console.ReadKey(); }