Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IDbFunktioner[] array = new IDbFunktioner[4];
            array[0] = new Hund();
            array[1] = new Ubåd();
            array[2] = new Hund();
            array[3] = new Ubåd();
            foreach (var item in array)
            {
                item.Gem();
            }



            logger.Debug("Start af program");



            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ITier[] tierSammlung = new ITier[3];

            tierSammlung[0] = new Löwe(10, "Weibchen");
            tierSammlung[1] = new Hund(5, "Männchen");
            tierSammlung[2] = new Hund(8, "Weibchen");

            foreach (ITier tier in tierSammlung)
            {
                if (tier is Löwe)
                {
                    Console.WriteLine("Der Löwe ist " + tier.Alter + " und ein " + tier.Geschlecht);
                }
                else if (tier is Hund)
                {
                    Console.WriteLine("Der Hund ist " + tier.Alter + " und ein " + tier.Geschlecht);
                }
            }
            Console.ReadKey();
        }