Explicit Interface Implementation : Explicit Interface Implementation : Class C# Examples


C# Examples » Class » Explicit Interface Implementation »

 

Explicit Interface Implementation









    
using  System;

interface  InterfaceOne
{
        void  Execute();
}

interface  InterfaceTwo
{
        void  Execute();
}

class  MyImplementation:  InterfaceOne,  InterfaceTwo
{
        void  InterfaceOne.Execute()  
        {
                Console.WriteLine("InterfaceOne.Execute  implementation");
        }
        void  InterfaceTwo.Execute()
        {
                Console.WriteLine("InterfaceTwo.Execute  implementation");
        }
}

class  MainClass
{
        public  static  void  Main()
        {
                MyImplementation  MyImplementation  =  new  MyImplementation();
                
                InterfaceOne  InterfaceOne  =  (InterfaceOne)  MyImplementation;
                InterfaceOne.Execute();
                
                InterfaceTwo  InterfaceTwo  =  (InterfaceTwo)  MyImplementation;
                InterfaceTwo.Execute();
        }
}
    
   
  
   



Output

InterfaceOne.Execute implementation
InterfaceTwo.Execute implementation


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Explicit Interface Implementation