Example #1
0
        static void Main(string[] args)
        {
            Eagle orzelPrawdziwy = new Eagle();
            //orzelPrawdziwy.Hello();
            var orzełJednakPtak = (Bird)orzelPrawdziwy;
            //orzełJednakPtak.Hello();

            IFlyable orzel = new Eagle();

            //orzel.Fly();

            IFlyable[] ptaki = new IFlyable[2];
            ptaki[0] = new Eagle();
            ptaki[1] = new Duck();
            ptaki[1].Fly();
            ptaki[0].Fly();

            var pingwinPingwin = new Penguin();

            pingwinPingwin.Swim();

            var pingwinPtak = (ISwimmable) new Penguin();

            pingwinPtak.Swim();
        }
Example #2
0
        static void Main(string[] args)
        {
            Сhicken Bob = new Сhicken();

            Bob.Name = "Бобик";

            Duck D1 = new Duck("Кусак", Gender.male);

            Duck D2 = new Duck("Катя", Gender.female);

            Eagle E = new Eagle("Гоша", 55.09, 1000);

            Duck D3 = D2.LayEgg(D1, "Уточка", Gender.female);

            D3.PrintInfo();

            Bob.PrintInfo();

            Pinguin P1 = new Pinguin("Лала", Gender.female);
            Pinguin P2 = new Pinguin("Тото", Gender.male);

            Pinguin Lolo = new Pinguin("Лоло", Gender.male, P1, P2, 200, 800);

            Lolo.PrintInfo();

            Console.ReadLine();
        }
Example #3
0
        public Eagle LayEgg(Eagle fth, string _name, Gender s)
        {
            if (_gen == Gender.male)
            {
                throw new Exception("Mother can't be male.");
            }

            string b = "Nestling";

            if (_name != null)
            {
                b = _name;
            }
            Eagle child = new Eagle(b, s, this, fth);

            return(child);
        }
Example #4
0
        static void Main(String[] args)
        {
            Eagle   eagle   = new Eagle();
            Penguin penguin = new Penguin();
            Fowl    fowl    = new Fowl();

            Animal[] animalList = { eagle, penguin, fowl };

            foreach (Animal eachAnimal in animalList)
            {
                if (eachAnimal.IsBird())
                {
                    Console.WriteLine("{0} is bird \n", eachAnimal);
                }
                else
                {
                    Console.WriteLine("{0} is not bird \n", eachAnimal);
                }
            }
            Console.ReadKey();
        }