Mid OOP

Which is better for API design: interface or abstract class?

  • Interfaces are preferred for public APIs because they:
  • Allow multiple inheritance
  • Support loose coupling
  • Avoid breaking changes when adding new implementations
  • Abstract classes are better for internal APIs where shared code is required.

More from C# Programming Tutorial

All questions for this course