示例#1
0
        static void Main(string[] args)
        {
            Animal myAnimal = new Animal();
            Animal myPig    = new Pig();
            Animal myDuck   = new Duck();

            myAnimal.sound();
            myPig.sound();
            myDuck.sound();
        }
示例#2
0
        static void Main(string[] args)
        {
            Animal myAnimal = new Animal(); // Create a Animal object
            Animal myPig    = new Pig();    // Create a Pig object
            Animal myDog    = new Dog();    // Create a Dog object

            myAnimal.animalSound();
            myPig.animalSound();
            myDog.animalSound();
        }
示例#3
0
        static void Main(string[] args)
        {
            Animal myAnimal = new Animal();
            Animal myPig    = new Pig();
            Animal myDog    = new Dog();

            myAnimal.animalSound();
            myPig.animalSound();
            myDog.animalSound();
        }