Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var b = new Banana();
            var s = new Strawberry();
            var m = new Mango();
            var c = new IceCubes();
            var p = new CellPhone();

            Console.WriteLine(b.Blend());
            Console.WriteLine(s.Blend());
            Console.WriteLine(m.Blend());


            List <IBlendable> fruits = new List <IBlendable>()
            {
                b, s, m, c, p
            };

            foreach (var fruit in fruits)
            {
                Console.WriteLine(fruit.GetType());
                Console.WriteLine(fruit.Blend());
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var b = new Banana();
            var m = new Mango();
            var s = new Strawberry();
            var c = new IceCubes();

            Console.WriteLine(b.Blend());
            Console.WriteLine(m.Blend());
            Console.WriteLine(s.Blend());

            List <IBlendable> fruits = new List <IBlendable>()
            {
                b, m, s, c
            };

            foreach (var fruit in fruits)
            {
                Console.WriteLine(fruit.Blend());
            }

            foreach (dynamic fruit in fruits)
            {
                Console.WriteLine(fruit.Blend());
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var b = new Banana();
            var m = new Mango();
            var s = new Strawberry();
            var c = new IceCubes();

            Console.WriteLine(b.Blend());
            Console.WriteLine(m.Blend());
            Console.WriteLine(s.Blend());

            List <IBlendable> fruits = new List <IBlendable> {
                b, m, s, c
            };

            foreach (IBlendable fruit in fruits)
            {
                Console.WriteLine(fruit.Blend());
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");

            var b = new Banana();
            var m = new Mango();
            var s = new Strawberry();
            var c = new IceCubes();

            Console.WriteLine(b.Blend());
            Console.WriteLine(m.Blend());
            Console.WriteLine(s.Blend());

            List <IBlendable> list = new List <IBlendable>()
            {
                b, m, s, c
            };

            foreach (dynamic blend in list)
            {
                Console.WriteLine(blend.Blend());
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var b = new Banana();
            var m = new Mango();
            var s = new Strawberry();
            var c = new IceCubes();

            Console.Write(b.Blend() + "\n\n");
            Console.Write(m.Blend() + "\n\n");
            Console.Write(s.Blend() + "\n\n");

            List <Iblendable> snax = new List <Iblendable>()
            {
                b, m, s, c
            };

            foreach (Iblendable f in snax)
            {
                Console.Write(f.Blend() + "\n\n");
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var b    = new Banana();
            var m    = new Mango();
            var s    = new Strawberry();
            var ice  = new IceCubes();
            var cell = new CellPhone();

            //Console.WriteLine(b.Blend());
            //Console.WriteLine(m.Blend());
            //Console.WriteLine(s.Blend());

            List <IBlendable> fruits = new List <IBlendable>()
            {
                b, m, s, ice, cell
            };

            foreach (dynamic f in fruits)
            {
                Console.WriteLine(f.Blend());
            }
        }