C# › Interfaces & Abstract Classes

What is the difference between an interface and an abstract class?

Beginner

Answer

An abstract class can hold state and shared implementation and supports single inheritance; an interface is a contract a type can implement many of. Use interfaces for capabilities, abstract classes for a shared base.
public interface IPayable { decimal Pay(); }
public abstract class Employee : IPayable { public string Name=""; public abstract decimal Pay(); }
Real-world example IPayable expresses the capability; Employee shares Name across subtypes.