Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Difference between Abstract Class and Interface in C#

The special class which cannot be instantiated is known as abstract class, whereas the interface enables us to determine the functionality or functions but cannot implement that. Let’s find out some major differences between abstract class and interface in c#.

What is Abstract Class?

The special class which cannot be instantiated is known as an abstract class. These types of classes are either somewhat executed or not executed at all, and they can also be inherited by subclasses.

What is Interface?

The interface enables us to determine the functionality or functions but cannot implement that. It can also contain properties, methods, events, and indexers just like the class. However, the execution part will depend on the derived class as the interface includes only the declaration of the members.

Difference between Abstract Class and Interface in C#

S.No. Abstract Class Interface
1 The special class which cannot be instantiated is known as abstract class. The interface enables us to determine the functionality or functions but cannot implement that.
2 Abstract classes have static members. Interface does not have static members.
3 They have a constructor. They don’t have a constructor.
4 It includes both a declaration and an explanation. It includes only a declaration.
5 Here the performance is fast. Here the performance is slow.
7 A class has the liberty to only utilize a single abstract class. Here a class has the liberty to utilize multiple interfaces.
8 It is utilized to execute the core identity of class. It is utilized to execute the peripheral skills of the class.
9 It includes methods, fields, constants, etc. It only includes methods .
10 Abstract class can be fully, partially or not implemented. Interfaces can be fully implemented.

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Application Form, GATE Syllabus, GATE Cut off, GATE Previous Year Question Paper, and more.

Also Explore,

Comments

Leave a Comment

Your Mobile number and Email id will not be published.

*

*