Example #1
0
        static void Main(string[] args)
        {
            Animal myAnimal = new Animal(); // Crete an Animal object
            Animal myPig    = new Pig();    // Create a Pig object
            Animal myDog    = new Dog();    // Crete a dog object

            myAnimal.animalSound();
            myPig.animalSound();
            myDog.animalSound();
        }
        static void Main(string[] args)
        {
            Pig myPig = new Pig(); // Crete a Pig object

            myPig.animalSound();
        }