static void Main(string[] args) { Cook cook = new Cook(); Soup soup1 = cook.ToCook(new CarrotSoupBuilder()); Soup soup2 = cook.ToCook(new PotatoSoupBuilder()); Console.WriteLine(soup1); Console.WriteLine(soup2); Console.ReadLine(); }
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(); }