static void Main(string[] args)
        {
            Pizza atum = new Atum();


            Ingrediente tomate     = new Tomate(atum);
            Ingrediente aliche     = new Aliche(tomate);
            Ingrediente molhoextra = new MolhoExtra(aliche);
            Ingrediente queijo     = new QueijoExtra(molhoextra);


            Console.WriteLine(String.Format("Valor Total da Pizza: {0}", queijo.RetornarPreco()));

            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            Pizza atum = new Atum();


            //princípio da inversão de dependencia
            Ingrediente tomate = new Tomate(atum);
            Ingrediente aliche = new Aliche(tomate);



            Console.WriteLine(String.Format("Valor Total da Pizza: {0}", aliche.RetornarPreco()));

            Console.ReadKey();
        }