I have a doubt in below program:-
when i m calling the CallMe method from derived class instace and object it calls only the Abstract method not the interface method why so can anyone spread some light on it??
it works fine if i create object of interface and abstract and allocate memory of derived class.
interface M1
{
void CallMe();
}
public abstract class ME
{
public abstract void CallMe();
}
public class Derive:ME, M1
{
void M1.CallMe()
{
Console.WriteLine("I am interface method");
}
public override void CallMe()
{
Console.WriteLine("I am abstract class method");
}
}
class Program
{
static void Main(string[] args)
{
Derive obj = new Derive();
obj.CallMe();
Console.ReadLine();
}
}
Output: I am abstract class method
Deepak BishtPosted May 9, 2013, 1:30 AM
VulpesPosted May 8, 2013, 11:11 AM
obj.CallMe();
Deepak BishtPosted May 8, 2013, 6:31 AM
However i didnt get 'Explicit' as i guess we have to implement interface as well as abstract method explicitly or isnt so?? please brief
here wat i understand with word explicit is to manually writing code for that.
VulpesPosted May 8, 2013, 4:06 AM
((M1)obj).CallMe();