What is the difference between an interface and an abstract class 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 a few methods are to be declared by the base class and the deriving class implements the functionalities.

The following are the differences −

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

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

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

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

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 22-Jun-2020

393 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements