O'Reilly logo

Special Edition Using C# by NIIT

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Interface Implementation

Interfaces can be implemented by using classes and structs. The interface name is specified in the base class list of the implementing class or struct.

Explicit Interface Member Implementation

The term explicit interface member implementation refers to a method, property, event, or indexer declaration that references a fully qualified interface member name. This is shown in the following example:

using System; 
interface Inter1 
{
    void Method1(); 
} 
interface Inter2 
{
    void Method2(); 
} 
class Class1: Inter1, Inter2 
{
    void Inter1.Method1() 
    {
        //Implementation code 
    } 
    void Inter2.Method2() 
    {
        //Implementation code 
    } 
}

Here, Inter1.Method1() and Inter2.Method2() are explicit interface member implementations.

One important point ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required