Difference in Interface and Abstract class in c#

Interface :  An interface is like a contract which is followed by the class that implemented interface, it can have property,method,delegate or event. An interface just have declaration has no definition. Interface members are public by default,

Abstract Class : A class declared as abstract keyword.

It can not be instantiated because it is incompleted.

Abstract Class can only be used as a base class.

Any class inheriting an Abstract class must provide implementation for abstract members. Note– If child class do not want implementation for all abstract method mark child class as abstract.

Differences :

1) Abstract class can have definition and interface can’t have.

2)Abstract class can have access modifier and interface can’t have.

3)Abstract class can have fields and interface can’t have.

4) Abstract class can inherit an interface or another abstract class but interface can inherit in an interface.

Leave a comment