This Angular tutorial helps you get started with Angular quickly and effectively through many practical examples.

Abstract vs Interface


In this article we are going to discuss difference between Abstract and Interface in C#. There are many blogs, articles are available on the internet regarding Abstract and Interface but in this particular article I will try to explain to you with as much as simple.

1. Abstract Class

Provides a base class that can include both fully implemented members and abstract members that must be implemented by derived classes.

1. Abstract class contains both DECLARATION & DEFINITION of methods.

Abstract Class and Interface in C#

2. Abstract class keyword: ABSTRACT

Abstract Class and Interface in C#

3. Abstract class does not support multiple inheritance

Abstract Class and Interface in C#

4. Abstract class can have constructors.

Abstract Class and Interface in C#

2. Interface

Defines a contract with no implementation. It specifies what methods, properties, events, or indexers a class should implement but does not provide any implementation.

1. Mostly Interfaces contain DECLARATION of methods. From C# 8.0 definition is also possible.

Abstract Class and Interface in C#

2. Interface keyword: INTERFACE

Abstract Class and Interface in C#

3. Interface supports multiple inheritance.

Abstract Class and Interface in C#

4. Interface do not have constructors.

Abstract Class and Interface in C#
Prev Next