예제 #1
0
        public AbstractFactoryCars FactoryMethod(AllCars CarType)
        {
            AbstractFactoryCars abstractFactoryCars = null;

            switch (CarType)
            {
            case AllCars.Sedan:
                abstractFactoryCars = new Sedan();
                break;

            case AllCars.Hatchback:
                abstractFactoryCars = new Hatchback();
                break;

            case AllCars.StationWagon:
                abstractFactoryCars = new StationWagon();
                break;

            case AllCars.Suv:
                abstractFactoryCars = new Suv();
                break;

            case AllCars.PicUp:
                abstractFactoryCars = new PicUp();
                break;
            }
            return(abstractFactoryCars);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AllCars             uretilecekarac      = (AllCars)this.comboBox1.SelectedItem;
            Creater             creater             = new Creater();
            AbstractFactoryCars abstractFactoryCars = creater.FactoryMethod(uretilecekarac);

            abstractFactoryCars.Lastikler();
            abstractFactoryCars.Motor();
            abstractFactoryCars.Renk();
            abstractFactoryCars.Test();
            textBox1.Text += abstractFactoryCars.IslemSonuc() + " ";
        }