Complete the code to declare an interface named IAnimal.
public interface [1] { string Speak(); }The interface name should start with 'I' by convention, so IAnimal is correct.
Complete the code to make the Dog class implement the IAnimal interface.
public class Dog : [1] { public string Speak() { return "Woof!"; } }
The class Dog implements the interface IAnimal using a colon.
Fix the error in the code by completing the interface method declaration.
public interface IAnimal { string [1](); }The interface requires a method named Speak to be implemented by classes.
Fill both blanks to create a dictionary that maps animal names to their sounds using interface methods.
var sounds = new Dictionary<string, string> { {"Dog", dog.[1]()}, {"Cat", cat.[2]()} };Both dog and cat objects implement the Speak method from the interface.
Fill all three blanks to define an interface, implement it in a class, and call its method.
public interface [1] { string [2](); } public class Bird : [3] { public string Speak() { return "Chirp!"; } }
The interface is named IAnimal, the method is Speak, and the class Bird implements IAnimal.