What is the difference between abstract class and interface in C#?

Answer

Abstract class: can have implemented methods (behavior), instance fields, constructors, and abstract (unimplemented) methods. A class can inherit from only one abstract class. Use when: related classes share state or behavior, and you want to provide a base implementation. Interface: historically only defined a pure contract (no implementation). C# 8+ allows default implementations. A class can implement multiple interfaces. Use when: defining capabilities across unrelated class hierarchies. When to choose: choose abstract class when you're providing a partial implementation that subclasses complete (Template Method pattern). Choose interface when you want to define a capability that many unrelated classes can implement (e.g., IComparable, IDisposable). Modern C#: with default interface methods closing the gap, the distinction is smaller — but interfaces remain better for defining cross-cutting capabilities.