A
andreister
public interface IFood { }
public interface IMonkey { void Eat(IFood food); }
public class Bread : IFood { }
public class Gorilla : IMonkey
{
public void Eat(Bread bread)
{ }
}
Compiler error: 'Gorilla' does not implement interface member
'IMonkey.Eat(IFood)'
I would expect there should be no problem with it because Bread is
inherited from IFood... Could anybody explain?
Thanks, Andrew
public interface IMonkey { void Eat(IFood food); }
public class Bread : IFood { }
public class Gorilla : IMonkey
{
public void Eat(Bread bread)
{ }
}
Compiler error: 'Gorilla' does not implement interface member
'IMonkey.Eat(IFood)'
I would expect there should be no problem with it because Bread is
inherited from IFood... Could anybody explain?
Thanks, Andrew