Question 14 (5 points) Glven the following class definitions, which of the following lines is a valid example of Polymor
Posted: Mon Jul 11, 2022 9:57 am
Question 14 (5 points) Glven the following class definitions, which of the following lines is a valid example of Polymorphism? Java class Animal { public int numLegs; } class Dog extends Animal { public String name; public Dog(String newName) { name=newName; } A. C# class Animal { public int numLegs; } class Dog: Animal { public string name; public Dog(string newName) { name=newName; } } Dog] myDogs = new Dog[5]; myDogs[0]=new Animal(); B. Dog myDogs = new Dog[5]; myDogs[0]=new Dog("Molly"); C. Animal] myAnimals = new Animal[5]; myAnimals[0]=new Dog("Molly"); D. Animal[] myAnimals = new Animal[5]; myAnimals[0]=new Animal();