Interface is used in the C# for declaring the function etc, which can be implement, in the various class. It is similar to the base class which can be inherit into the derived but it is multilayered and class inherit concept is single layer hence it is more accessible.
For Example-
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication11 { interface Interface1 { void SampleMethod(); } interface Interface2 { void SampleMethod2(); } class interfacedemo : Interface1, Interface2 { public void SampleMethod() { Console.WriteLine("Sample Method"); } public void SampleMethod2() { Console.WriteLine("SampleMethod2"); } static void Main() { interfacedemo obj = new interfacedemo(); obj.SampleMethod(); obj.SampleMethod2(); Console.ReadLine(); } } }
Liked By
Write Answer
What is a basic concept of Interface
Join MindStick Community
You have need login or register for voting of answers or question.
Jonas Stuart
15-Sep-2016Interface is used in the C# for declaring the function etc, which can be implement, in the various class. It is similar to the base class which can be inherit into the derived but it is multilayered and class inherit concept is single layer hence it is more accessible.
For Example-