Код: Выделить всё
interface IAnimal {
IFood GetPreferredFood();
}
Код: Выделить всё
class Cat(F food) : IAnimal where F : IFood {
private F _food = food;
public F GetPreferredFood() {
return _food;
}
}
Код: Выделить всё
CS0738: 'Cat' does not implement interface member 'IAnimal.GetPreferredFood()'.
'Cat.GetPreferredFood()' cannot implement 'IAnimal.GetPreferredFood()' because it does not have the matching return type of 'IFood'.
Подробнее здесь: https://stackoverflow.com/questions/798 ... -parameter
Мобильная версия