Ejemplo n.º 1
0
        private void btnCreateCake_Click(object sender, EventArgs e)
        {
            lbYourCake.Items.Clear();

            CakeBase cake = cm.GetCake();

            if (cake == null)
            {
                return;
            }
            List <CakeBase> wholeCake = cake.CreateCake();

            foreach (CakeBase cb in wholeCake)
            {
                lbYourCake.Items.Add(cb.Name);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var chocolateCakeMaker = new CakeMaker(new ChocolateCake());

            chocolateCakeMaker.MakeCake();
            var cake = chocolateCakeMaker.GetCake();

            cake.ServeCake();

            System.Console.WriteLine("=========================================");

            var strawberryCakeMaker = new CakeMaker(new StrawberryCake());

            strawberryCakeMaker.MakeCake();
            var strawberryCake = strawberryCakeMaker.GetCake();

            cake.ServeCake();
        }