Esempio n. 1
0
        static void Main(string[] args)
        {
            PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
            Cook cook = new Cook();
            cook.SetPizzaBuilder(hawaiianPizzaBuilder);
            cook.ConstructPizza();
            // create the product
            Pizza hawaiian = cook.GetPizza();

            PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();
            cook.SetPizzaBuilder(spicyPizzaBuilder);
            cook.ConstructPizza();
            // create another product
            Pizza spicy = cook.GetPizza();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
            var          cook = new Cook();

            cook.SetPizzaBuilder(hawaiianPizzaBuilder);
            cook.ConstructPizza();
            // create the product
            var hawaiian = cook.GetPizza();

            PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();

            cook.SetPizzaBuilder(spicyPizzaBuilder);
            cook.ConstructPizza();
            // create another product
            var spicy = cook.GetPizza();
        }
Esempio n. 3
0
        // Builder - abstract interface for creating objects (the product, in this case)

        // Director - responsible for managing the correct sequence of object creation.
        // Receives a Concrete Builder as a parameter and executes the necessary operations on it.
        public void TestBuilder()
        {
            PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder();
            var          cook = new Cook();

            cook.SetPizzaBuilder(hawaiianPizzaBuilder);
            cook.ConstructPizza();
            // create the product
            Pizza hawaiian = cook.GetPizza();

            PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();

            cook.SetPizzaBuilder(spicyPizzaBuilder);
            cook.ConstructPizza();
            // create another product
            Pizza spicy = cook.GetPizza();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            PizzaBuilder hawaiianpizzabuilder = new HawaiianPizzaBuilder();
            Cook         cook = new Cook();

            cook.SetPizzaBuilder(hawaiianpizzabuilder);
            cook.ConstructPizza();
            Pizza hawaiian = cook.GetPizza();
        }