C# Interface

Interface in C# is a blueprint of a class. It is like abstract class because all the methods which are declared inside the interface are abstract method.

- It can't have method body and can't be instantiated.

- It is used to achieve the multiple inheritance which can't be achieved by class, it is used to achieve fully abstraction because it can't have method body.

- An Interface can contain

  1. Abstract methods

  2. Properties

  3. Indexes

  4. Events

- An Interface cannot contain

  1. Non-Abstract methods

  2. Data fields

  3. Constructors

  4. Destructors

Comments

Popular posts from this blog

C# | Association, Aggregation and Composition

Throw vs Throw ex in C#

String[] args in C#