Interface in Detail
Interface in
C# is basically a contract in which we declare only signature. The class which
implemented this interface will define these signatures. Interface is also a
way to achieve runtime polymorphism. We can add method, event, properties and
indexers in interface
Syntax of Interface
We declare
interface by using the keyword interface which is as follows:-
public interface interface_name
{
//here we define our signature
}
For Example:-
Create an
interface and add some signature of method
public interface Idef1
{
//singnature
of methods
int sum(int x, int y);
int mul(int x, int y);
}