예제 #1
0
        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();
        }
예제 #2
0
파일: Program.cs 프로젝트: ksush23/Patterns
        static void Main(string[] args)
        {
            ICarFactory   carFactory = new ToyotaFactory();
            ClientFactory client1    = new ClientFactory(carFactory);

            client1.Run();

            carFactory = new FordFactory();
            ClientFactory client2 = new ClientFactory(carFactory);

            client2.Run();

            Console.ReadKey();
        }
예제 #3
0
        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();
        }
예제 #4
0
        static void Main(string[] args)
        {
            ICarFactory   carFactory = new ToyotaFactory();
            ClientFactory client1    = new ClientFactory(carFactory);

            client1.Run();

            carFactory = new FordFactory();
            ClientFactory client2 = new ClientFactory(carFactory);

            client2.Run();
            Console.WriteLine("");

            carFactory = new MercedesFactory();
            ClientFactory client3 = new ClientFactory(carFactory);

            client3.Run();
            Console.WriteLine("");

            Console.ReadKey();
        }
예제 #5
0
 public ToyotaAssemblyLine(ToyotaFactory factory)
 {
     _factory = factory;
 }