C Sharp (C#) - Interfaces
What will be the output of this C# code?
interface IAnimal { void Speak(); }
class Dog : IAnimal { public void Speak() { Console.WriteLine("Woof"); } }
class Cat : IAnimal { public void Speak() { Console.WriteLine("Meow"); } }
static void Main() {
IAnimal animal = new Dog();
animal.Speak();
animal = new Cat();
animal.Speak();
}