예제 #1
0
        public void BatmanAndVampireBatCanReturnDifferentStringsForHowIFlyMethod_ProvingMethodOverride()
        {
            Batman     bruceWayne = new Batman();
            VampireBat vampBat    = new VampireBat();


            Assert.NotEqual(bruceWayne.HowIFly(), vampBat.HowIFly());
        }
예제 #2
0
        // Method which prints out several properties and methods of the Batman Class
        public static void DisplayBatman()
        {
            Console.WriteLine(
                "Here is Batman, he is derived from the " +
                "Animal -> Mammal -> Bat Classes in order.\n");

            Console.WriteLine(
                "Batman inherets all of the properties and methods accociated with those Classes.\n" +
                "He also inherets the ICanFly Interface from the Bat Class.\n");

            Batman bruceWayne = new Batman();

            Console.WriteLine($"How Batman eats: {bruceWayne.Eat(bruceWayne.Diet)}\n");

            Console.WriteLine($"What does Batman wear: {bruceWayne.BodyCovering}\n");

            Console.WriteLine($"What sound does Batman make: {bruceWayne.MakeSound(bruceWayne.Sound)}\n");

            Console.WriteLine(
                $"Is it true that Batman has inner ear bones: {bruceWayne.HasEarBones}\n");

            Console.WriteLine($"How does Batman fly: {bruceWayne.HowIFly()}\n");
        }