Explicit Interface Implementation

Posted by in OOPS category on for Intermediate level | Points: 250 | Views : 3203 red flag
Rating: 3 out of 5  
 1 vote(s)

This article gives a basic idea on achieving an Explicit Interface implementation.


This article gives a basic idea on how to achieve Explicit Interface implementation.


The explicit interface implementation in OOPS states how to use same method name in multiple interfaces, how the implementation part of same method name should be carried out.

Using the code

In this article we used two interfaces iTeacher,iStudent which will have a Name method.

    interface iTeacher
        void Name();
    interface iStudent
        void Name();
 class Program :iTeacher,iStudent
{ void iTeacher.Name() { Console.WriteLine("iteacher Interface Name Method"); } void iStudent.Name() { Console.WriteLine("iStudent Interface Name Method"); } static void Main(string[] args) { iStudent iS=new Program(); iS.Name(); iTeacher iT = new Program(); iT.Name(); Console.ReadKey(); } }

In the above code, two interfaces used a common method as Name. The basic part of an interface is it must be implemented by a derived class in order to make use of an interface methods.

When the interfaces has got two methods with the same name then we need to use an Explicit Interface mechanism in order to achieve two identical implementations which can be achieved by using the interface name following a method name as per the syntax.


This article particularly focuses on how to make use of an explicit interfaces with the same method names.



Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Sayeed Ahmed
Member Level: Bronze
Member Status: Member
Member Since: 12/22/2011 7:45:35 AM
Country: India
Join Hands Change lives Thanks & Regards Straight Edge Society

Login to vote for this post.

Comments or Responses

Posted by: Pari098 on: 7/29/2019 | Points: 25
I am always get know that how this function will be done in this information http://controlpanelwindows10.com that what are main uses of this control panel.

Login to post response

Comment using Facebook(Author doesn't get notification)