Пример #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();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //Builder
            PizzaBuilder builder;

            //Director
            var pizzeria = new Pizzeria();

            // Construct and display pizzas

            builder = new PepperoniPizzaBuilder();
            pizzeria.Construct(builder);
            builder.Pizza.Summarise();

            builder = new HawaiianPizzaBuilder();
            pizzeria.Construct(builder);
            builder.Pizza.Summarise();

            builder = new MargheritaPizzaBuilder();
            pizzeria.Construct(builder);
            builder.Pizza.Summarise();

            Console.ReadLine();
        }