Hi guys,
Can someone tell me why I am getting output as I am from I1 in both the cases explained below.
interface I1
{
void Cal1();
}
interface I2
{
void Cal1();
}
class Program: I1,I2
{
void I1.Cal1()
{
Console.WriteLine("I am from I1");
}
void I2.Cal1()
{
Console.WriteLine("I am from I2");
}
static void Main(string[] args)
{
I1 i1 = new Program();
i1.Cal1(); //Actual output: I am from I1
I1 i2 = new Program();
i2.Cal1(); //Actual output: I am from I1, Expecting I am from I2

VulpesPosted Oct 12, 2014, 8:55 AM
I2 i2 = new Program();
i2.Call();
Prakash TripathiPosted Oct 16, 2014, 12:08 AM
Munesh SharmaPosted Oct 13, 2014, 12:32 AM
http://csharp.net-tutorials.com/classes/interfaces/