| Interface | Abstract Class |
|---|---|
| Interface is nothing but contract of the system which can be implemented on classes. | Abstract class is special kind of class that can not be instantiated but can be inherited. |
| A class may inherit several interfaces. | A class may inherit only one abstract class. |
| An interface cannot provide any code, just the signature. | An abstract class can provide signature as well as code to be overridden in the child classes. |
| Members of interface does not have any access modifier. | Members of abstract class have an access modifier. |
| An interface can not contain fields, constructor, destructor. | An abstract class can contain fields, constructor, destructor. |
| A class implementing an interface has to implement all the methods of the interface | A class implementing an abstract class does not need to implement all the methods of the abstract class |
| If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method. | If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly. |
| Reference can be created, it depends on child class object's memory. | Reference can not be created. |
Thursday, February 5, 2015
Difference between Interface and Abstract Class
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Many times, it happens that we get an error or exception message while working on the Dynamics 365 UCI form . So, to get more informatio...
-
Problem Statement - While creating Power Automate we may face situation where connection reference for the Dataverse Connector missing and w...
-
C++ and C# both are object oriented languages. Lets check out the main difference between them:- ...
-
Previous Post - Validate Data Export Profile In this part we will replicate data to Azure SQL Database using Data Export Service profile th...
-
The aim of this topic is to make a clear understanding of what is Entity Change Tracking and how Entity Change Tracking works. Many of ...
No comments:
Post a Comment