When to use interface and abstract class in C#.


  • Abstract classes have some implemented functionality so you can use the same functionality among all your implementations. Its the best example of re-usability of code. While Interfaces don’t provide any implementation of code.
  • If you are thinking about multiple version of your component then create abstract class. Abstract classes provide a simple and easy way to version your component. By updating base class, all the inheriting classes are automatically updated. While Interfaces can not be changed once created. Interfaces needs to be recreated.
  • Abstract classes are useful for large scale functionality While interface are useful in Small scale of functionality.