I was debating between which would be better for a particular C# class in a project that I'm working on: An Interface or an Abstract Class. So I decided to do some research and highlight the advantages and disadvantages:
- A class can inherit (implement) multiple Interfaces (+). It can only inherit one Abstract Class (-).
- Inheritance of an Interface forces the implementation of all parts of the Interface (+).
- Code might be duplicated using an Interface (-) while it could be written once in an Abstract Class (+).
An Interface is not necessarily better than an Abstract Class. Pick the right tool for the job once you know what the job is.