DEV Community

Cover image for Difference between Abstract Class and Interface
Bekzod
Bekzod

Posted on

Difference between Abstract Class and Interface

                  **Abstract Class**
Enter fullscreen mode Exit fullscreen mode

1.It contains both declaration and definition part
2.Multiple inheritance is not achieved by abstract class
3.It can contain static members and It contain constructor
4.It can contain different types of access modifiers like
public, private, protected
5.A class can only use one abstract class.
6.If many implementations are of the same kind and use common behavior, then it is superior to use abstract class.
7.It can be fully, partially or not implemented.

                   **Interface**
Enter fullscreen mode Exit fullscreen mode

1.It contains only a declaration part
2.Multiple inheritance is achieved by interface.
3.It does not contain static members.
4.It does not contain constructor.
5.It only contains public access modifier because everything in the interface is public.
6.A class can use multiple interface.
7.Interface can only contains methods, properties, indexers, events.

Top comments (0)