Interface
Interface used for controlling the class. Interface does not contain and implement anything but method which has created by the interface will be implemented by Class. Suppose there is a class University, Interface UGC on base and class College is a child as in the following code snippet:
- Interface UGC {
- Public void Get()
- Public void Display()
- }
- Class University: UGC
- String Name, Adress, Type;
- Public void Get() {
- Console.Write(“Enter the University Name, Adress and Type: ”);
- This.Name = Console.ReadLine();
- This.Adress = Console.ReadLine();
- This.Type = Console.ReadLine();
- }
- Public void Display() {
- Console.WriteLine(“University Name is: ”+this.Name);
- Console.WriteLine(“University Address is: ”+this.Adress);
- Console.WriteLine(“University Type is: ”+this.Type);
- }
- Class College: University
- String Name, Adress, Type;
- Public void Get() {
- Console.Write(“Enter the College Name, Adress and Type: ”);
- This.Name = Console.ReadLine();
- This.Adress = Console.ReadLine();
- This.Type = Console.ReadLine();
- }
- Public void Display() {
- Console.WriteLine(“College Name is: ”+this.Name);
- Console.WriteLine(“College Address is: ”+this.Adress);
- Console.WriteLine(“College Type is: ”+this.Type);
- }
- Class Interface_Implementation
- Public void Main(); {
- College obj = new College();
- Obj.get();
- Obj.Display();
- }
- Console.ReadLine();
- }
- }
Recap
Interface does not implement and contain anything but it is used for controlling the class.

Christopher AndrewsPosted Nov 18, 2015, 4:09 AM
Thank you so much for the article. Definitely worth a try this error tracking tool for .net developers – www.redfly.io