Esempio n. 1
0
        static void Main()
        {
            var builder     = new MyHamburgerBuilder();
            var cook        = new Cook(builder);
            var myHamburger = cook.Build();

            cook.ChangeBuilder(new WifesHamburgerBuilder());
            var wifesHamburger = cook.Build();

            Console.WriteLine($"My Hamburger: {myHamburger}");
            Console.WriteLine($"My Wife's Hamburger: {wifesHamburger}");
        }
Esempio n. 2
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();
        }
 public Waiter(Cook cook)
 {
     this.cook = cook;
 }