4
Answers

Confusion in Multiple Inheritance using Interface.

Jigar Tailor

Jigar Tailor

9y
430
1
Hi All,
 
I have one confusion in following code.
 
class Program
{
   static void Main(string[] args)
   {
      MyClass myClass = new MyClass();
      myClass.Display();
      Console.ReadKey();
   }
}
public interface IOne
{
   void Display();
}
 
public interface ITwo
{
   void Display();
}
public class MyClass : IOne, ITwo
{
   public void Display()
   {
      Console.WriteLine("test");
   }
}
In above code which display method will get called Display() of IOne or Display() of ITwo? 
Answers (4)