What is the difference between an abstract method and a virtual method?
Quick Answer
An abstract method has no body and must be overridden by a non-abstract derived class — it only exists in an abstract class. A virtual method has a default implementation that a derived class may override (and can call via base).
An abstract method is just a signature with no implementation, and any concrete subclass is forced to override it — it's how an abstract class says “you must fill this in.” A virtual method has a working default; subclasses can override it if they want something different, and they can still call the base version. Both are polymorphic, so a base-class reference calls the derived implementation. You'd use abstract when there's no sensible default and every subclass is genuinely different, and virtual when most subclasses are fine with the default.
abstract— “every subclass must provide this”. Forces the contract.virtual— “here's a reasonable default; override it if you need to”.- Both use dynamic dispatch (the runtime picks the derived version through a base reference).
- An abstract class can mix abstract members, virtual members with defaults, and non-virtual concrete members.
- Interfaces (pre-C# 8) are like all-abstract; C# 8+ default interface methods are like virtual.