static void Main(string[] args) { List <HamburgerBuilder> menu = new List <HamburgerBuilder>(); menu.Add(new VeggHamburgerBuilder()); menu.Add(new MeatburgerBuilder()); menu.Add(new VeggHambBuilderLettuce()); Hamburger hamb = PrepareHamburger(menu[2]); Console.WriteLine(hamb); ////////////////////////////////////////////////////////////// HumburgerFactory factory = new HumburgerFactory(); List <Hamburger> hums = new List <Hamburger>(); hums.Add(factory.createHamburger("veg")); hums.Add(factory.createHamburger("meat")); foreach (var hum in hums) { Console.WriteLine(hum); } }
static void Main(string[] args) { List <HamburgerBuilder> menu = new List <HamburgerBuilder>(); menu.Add(new VeggHamburgerBuilder()); menu.Add(new MeatburgerBuilder()); menu.Add(new VeggHambBuilderLettuce()); Hamburger hamb = PrepareHamburger(menu[0]); ////////////////////////////////////////////////////////////// HumburgerFactory factory = new HumburgerFactory(); Hamburger hums1 = new Hamburger(); hums1 = factory.createHamburger("veg"); Console.WriteLine(hums1); Hamburger hums2 = new Hamburger(); hums2 = factory.createHamburger("meat"); Console.WriteLine(hums2); }