What is Interace in C#Interface---->> If a class contain all abstract function then it is known as an interface.Interface do not provide Implementation.They are implemented by the class and defined as seprate entities from class. An Interface represent a contract in that a class that implements an interface must implement every aspect of that interface exactly as it is defined.
In general Interface provides control over the class. we can define feature as small groups of closly related members and can developed enhanced implementation for your interfaceswithout jeoparadizing existing code,thus minimizing compitability problems.
It is also possible to add new feature to any time by developing adding additional interfaces and implementations.Although intrface implementations can evolve, interfaces themselves cannot be changed once published.
An Interface can contain
1) Abstract functions
An Interface can not contain
By default interface functions are treated as public and abstract.An Interface can not be instantiated directly. Creating/deriving a new class or other interface from an Interface is compulsary/mandatory in order to provide implementation to abstract function. An interface can itself inherit from multiple interfaces.An Interface is used to implement Multiple inheritance in C#.Net.
Program to implement Interface---
class Manager : Employee
double Bonus, CA;
public void GetEmpData()
Console.Write("Enter Managers Details :-");
EmpId = Convert.ToInt32(Console.ReadLine());
EName = Console.ReadLine();
Bonus = Convert.ToDouble(Console.ReadLine());
CA = Convert.ToDouble(Console.ReadLine());
public void DispalyEmpData()
Console.WriteLine("Manager Id is" + EmpId);
Console.WriteLine("Manager Name is" + EName);
Console.WriteLine("Manager Bonus is" + Bonus);
Console.WriteLine("Manager CA is" + CA);
static void Main(string args)
Manager Obj1 = new Manager();
Enter manager Detail is-- 10
Manager Id is:- 10
Manager Name is:- ravi
Manager Bonus is:- 15000
Manager CA is:- 25000