Beispiel #1
0
        static void Main()
        {
            Tiger Amur = new Tiger();

            Amur.protection_status();
            Amur.color();
            WhiteTiger Timur = new WhiteTiger();

            Timur.protection_status();
            Timur.color();
            Kitten Mur = new Kitten();

            Mur.protection_status();
            Mur.color();
            Mur.noise();
            Mur.quantity = 3;
            Console.WriteLine("This quantity of kitten of white tiger is {0}", Mur.quantity);
            Goose Grey = new Goose(10);

            Grey.protection_status();
            Grey.features();
            Console.WriteLine(Grey.speed);
            Grey.swim();
            Sparrow Captain = new Sparrow();

            Captain.protection_status();
            Captain.features();
            Captain.speed = 7;
            Console.WriteLine("Speed of Captain is {0}", Captain.speed);
            Captain.food();
            Captain.place();
            Captain.swim();
            Captain.size();
        }
Beispiel #2
0
        public void AreWhiteTigerAndZebraMonochrome()
        {
            WhiteTiger wtiger = new WhiteTiger();
            Zebra      zebra  = new Zebra();

            Assert.Equal(zebra.BlackOrWhite(), wtiger.BlackOrWhite());
        }
        static void Main(string[] args)
        {
            AnimalService animalService = new AnimalService();

            #region Domain Models instantation
            Animal ace    = new Animal("Ace", "green", true); // Create an object with constructor
            Animal stojan = new Animal("Stojan", "yellow", true);
            Animal mirce  = new Animal()
            {
                Spicies  = "Mirce",
                EyeColor = "green",
                CanSwim  = true
            };                                                                // Create an object in shorter way

            Cat bozana = new Cat();                                           // Cat inherits from class Animal

            Bird slave = new Bird("slavejce", "black", "white", false, true); // Bird inherits from class Animal

            Sparrow goran = new Sparrow("goran", "white", "awesome", "blue", true);
            Sparrow dejan = new Sparrow(); // Sparrow inherits from class Bird
            #endregion

            Console.WriteLine(animalService.GetInfo(mirce));
            Console.WriteLine(animalService.GetInfo(ace));
            Console.WriteLine(animalService.GetInfo(stojan));

            mirce.Eat();
            bozana.Eat();       // bozana is a Cat object but, the Eat methods belongs to Animal class, TIP: use hover on the Eat method for more information
            //rename and override Meow method
            bozana.MakeSound(); // bozana is a Cat object and the Meow method belongs to Cat class

            Tiger johny = new Tiger();
            johny.MakeSound();

            WhiteTiger jacky = new WhiteTiger();
            jacky.MakeSound();
            jacky.MakeATigerSound();

            Console.WriteLine(slave.Wings);


            Console.Read();
        }