โ Back to Interfaces
Question 607
Polymorphism With a List of Interfaces
Polymorphism With a List of Interfaces
The interfaceIAnimaldeclaresstring Speak(). CompleteCatso it returnsMeowandDogso it returnsWoof. The tester puts both in aList<IAnimal>and prints each animal's sound. Do NOT write aMainmethod. For a list holding aCatthen aDogthe program prints: Meow Woof
Expected Output:
Meow Woof
Topics:
Interfaces
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.