can have implementations for some of its members (Methods), but the
can't have implementation for any of its members.
provide definitions of methods that must be implemented by a class
. The purpose of interfaces is to allow you to generalise specific functionality regardless of implementation. You may have an IDatabase interface that defines
. The class that implements that interface may be connecting to a MySQL database or MS Access database. Irrespective of how it accomplishes this task, the goal is still the same.
Open database, close database.
are base classes that contain some abstract methods. They cannot be instantiated they are to be derived from. The purpose of an Abstract class is to allow you to define some generic functionality and sub-class to implement more specific functionality where appropriate.
So I suppose to summarize. You should use interfaces when the implementation of each class differs completely. Use abstract classes when you have some similar behaviour but need to implement parts differently.
Please have a look on following threads to get some needful:
This CP Article lists the differences between
Differences Between Interface and Abstract Classes
Difference Between an Abstract Class and an Interface in C#
Abstract class and Interface
Difference between Abstract class and Interface in C# .Net
8-Differences Between Interface and Abstract Class
Hope it helps!