The C# Interview Question That Reveals Your Version!
By Fuat Can Koseoglu,
The C# Interview Question That Reveals Your Version! "What's the difference between abstract class and interface?" If you answered "interfaces can't have implementation," you’re missing some modern C# magic. WHAT CHANGED: • C# 8 introduced default interface implementations. Interfaces can have method bodies. • C# 11 went further with static abstract members. The textbook answer evolved significantly. THE DESIGN HEURISTIC: Abstract Class = "IS-A" (Identity) • Defines what something fundamentally IS • Core to the object's essence • A Dog IS an Animal - that's identity Interface = "CAN-DO" (Capabilities) • Defines additional behaviors • Not essential to identity • A Dog CAN swim, but so can a Robot This guides your design: You can only BE one thing (single inheritance) but can DO many things (multiple interfaces). But remember, this is a design perspective - the runtime tells a different story. THE REAL DIFFERENCES THAT REMAIN: • Instance State • Interfaces cannot declare fields or participate in construction. Constructor Participation • Abstract classes can participate in constructor chains, enabling controlled initialization. Interfaces don't participate in object construction at all. Performance Impact • Interface dispatch requires double indirection (IMT + vtable). In tight loops, this adds measurable overhead (unless the JIT can inline). Method Ambiguity • Default implementations in multiple interfaces can create ambiguity, similar to the diamond problem. The compiler forces explicit resolution. Memory Layout • Abstract class fields become part of the derived object's memory layout. • Interfaces are just contracts - no extra allocation unless you're boxing value types to interface references. WHEN TO USE WHAT: Abstract Class wins when: • Shared state/fields needed • Constructor initialization required • Performance critical paths • Defining core identity Interface wins when: • Multiple inheritance needed • Defining contracts/capabilities • Plugin architectures • Testing/mocking scenarios THE INTERVIEW CHALLENGE: • Both can have implementations now. But at the CLR level, one limitation will never change. Follow for O(1) access to daily game dev tips!