3
Reply

What is an Interface in C#?

Vinay  Arora

Vinay Arora

11y
1.1k
0
Reply

    An interface is defined as a syntactical contract that all the classes inheriting the interface should follow. The interface defines the 'what' part of the syntactical contract and the deriving classes define the 'how' part of the syntactical contract. Interfaces are declared using the interface keyword. It is similar to class declaration. Interface statements are public by default.

    Also Interface does not allow any access modifiers inside it and does not allow field declaration. While compiling it will validate and force the deriving class to implement the code for methods defined inside an interface.

    Interface concept makes the entire class abstract classes.... There will not be any kind of implementation in interface. implementation should be done in derived class. indicates interface.