
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.