Page 1 of 1

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
by answerhappygod
Question 14 5 Points Glven The Following Class Definitions Which Of The Following Lines Is A Valid Example Of Polymor 1
Question 14 5 Points Glven The Following Class Definitions Which Of The Following Lines Is A Valid Example Of Polymor 1 (77.35 KiB) Viewed 22 times
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();