예제 #1
0
        static void Main(string[] args)
        {
            Invertibrate aLadyBug = new Invertibrate(8);
            Bird         aBird    = new Bird(4, true);
            Warmblooded  aPenguin = new Bird(4, false);
            Animal       me       = new Mammal(4);

            Console.Write("A ladybug makes the sound, ");
            aLadyBug.makesNoise();
            Console.WriteLine("A ladybug has {0} appendages", aLadyBug.getAppendages());

            Console.Write("A bird makes the sound, ");
            aBird.makesNoise();
            Console.WriteLine("A bird has {0} appendages", aBird.getAppendages());

            Console.Write("A penguin makes the sound, ");
            aPenguin.makesNoise();
            Console.WriteLine("A penguin has {0} appendages", aPenguin.getAppendages());

            Console.Write("I make the sound, ");
            me.makesNoise();
            Console.WriteLine("I have {0} Appendages, two of which are for weilding a keyboard and mouse!", me.getAppendages());
        }
예제 #2
0
        static void Main(string[] args)
        {
            Mammal m1 = new Mammal();
            Mammal m2 = new Mammal(7, "Herbivore");

            Console.WriteLine(m1.diet);
            Console.WriteLine(m2.diet);
            m1.MakeNoise();
            m2.MakeNoise();
            Bear b1 = new Bear();

            Console.WriteLine(b1.legs);
            Bear b2 = new Bear(4, "Honey Diet", "Yellow", "100 Acre Woods", true, 2);

            Console.WriteLine(b2.habitat);
            b2.MakeNoise2("TIGERRRRRR");
            b2.printStats();
            //YES
            Mammal b3 = new Bear();

            //NO
            //Bear m3 = new Mammal();
            b3.MakeNoise();
        }