Difference between Abstract Class and Interface in C#


Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members.

Abstract classes to some extent serve the same purpose, however, they are mostly used when only few methods are to be declared by the base class and the deriving class implements the functionalities.

Let us now see the difference between Abstract class and Interface in C#.

Inherit

A class may inherit more than one interface, whereas a class may inherit only one abstract class.

Member Field

You cannot define fields in an Interface whereas it is defined in case of an abstract class.

Access Modifiers

An interface do not have public , private , protected , internal etc. access modifiers because in an interface by default everything is public.

Multiple Inheritance

Multiple Inheritance cannot be achieved using Abstract whereas with Interface we can achieve it.

Updated on: 30-Jul-2019

445 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements