Interfaces
An interface is like a contract. It contains only the signatures of methods, properties, or events. A class implementing the interface must provide the code for those members.
Why use Interfaces?
- C# doesn't support multiple inheritance of classes, but it does support multiple interfaces.
- High security and decoupling.
csharp interface IAnimal { void Eat(); }
class Pig : IAnimal { public void Eat() => Console.WriteLine("Zzz"); }