Posts

Showing posts with the label Difference between Interface and abstract class

Difference between Interface and abstract class

Introduction: Hi everyone, in this article I will explain what is abstract class & Interface, what their purpose and what is the difference between them. Back Ground: Before starting I want to give a brief wind up on something like 1. Class: It is a collection of methods, attributes, Properties etc., all the methods in the class are concrete classes (definition already exists). 2. Concrete Methods: A method which contains the implementation. EX:- Public void ConcreteMethod() { Console.WriteLine(“Method with Implementation”); } 3. Abstract Methods: opposite of abstract methods,i.e. method which does not have implementation or body. Ex:- Public void AbstarctMethod(); 4. As we know both the abstract class and interface cannot be instantiated, because these are used for implementing the inheritance (which mean to derive), because of this we can use these by deriving in our class. Abstract Class: Definition: This is a class, which is a combination of both concrete and abstract methods (...