This is a surprise to me! When I was seeing a code of someone, I just noted this line (shortened version!)
interface IPrint
{
void PrintDateTimeNow();
}
class DatePrint : IPrint
{
void IPrint.PrintDateTimeNow()
{
throw new NotImplementedException();
}
public PrintDateTimeNow()
{
throw new NotImplementedException();
}
}
I tried to invoke this method and the function "PrintDateTimeNow()" is being called.
var obj = new DatePrint();
obj.PrintDateTimeNow();
That means, what is the purpose of the method IPrint.PrintDateTimeNow() ?
How to invoke IPrint.PrintDateTimeNow() ?
Why does the compiler allow an another method with the same name ?