コード例 #1
0
        public static AudiCar getCar()
        {
            AudiCar eCar = new AudiCar();

            eCar.setGearBox(new EGearBox());
            eCar.setStereo(new EStereo());
            eCar.setWheels(new EWheel());
            return(eCar);
        }
コード例 #2
0
        public static AudiCar getCar()
        {
            AudiCar mCar = new AudiCar();

            mCar.setGearBox(new MGearBox());
            mCar.setStereo(new MStereo());
            mCar.setWheels(new MWheel());
            return(mCar);
        }
コード例 #3
0
        public AudiCar getCar()
        {
            AudiCar audiCar = new AudiCar();

            audiCar.setGearBox(getGearBox());
            audiCar.setStereo(getStereo());
            audiCar.setWheels(getWheel());
            return(audiCar);
        }
コード例 #4
0
        public static AudiCar getCar()
        {
            AudiCar lCar = new AudiCar();

            lCar.setGearBox(new LGearBox());
            lCar.setStereo(new LStereo());
            lCar.setWheels(new LWheel());
            return(lCar);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: imshamim/Design-Patterns
        static void Main(string[] args)
        {
            AudiCar eCar = new AudiCar();

            eCar.setGearBox(new EGearBox());
            eCar.setStereo(new EStereo());
            eCar.setWheels(new EWheel());
            System.Console.WriteLine(eCar);

            AudiCar xCar = new AudiCar();

            xCar.setGearBox(new EGearBox());
            xCar.setStereo(new MStereo());
            xCar.setWheels(new LWheel());
            System.Console.WriteLine(xCar);
        }
コード例 #6
0
        static void Main(string[] args)
        {
            ICarFactory factory = new EconomyCarFactory();
            AudiCar     car1    = new AudiCar();

            car1.setGearBox(factory.getGearBox());
            car1.setStereo(factory.getStereo());
            car1.setWheels(factory.getWheel());
            System.Console.WriteLine(car1);

            factory = new MediumCarFactory();
            AudiCar car2 = new AudiCar();

            car2.setGearBox(factory.getGearBox());
            car2.setStereo(factory.getStereo());
            car2.setWheels(factory.getWheel());
            System.Console.WriteLine(car2);
        }