次のエラーが発生します。
ClassName.PropertyNameは、IBasePropertyTypeの一致する戻りタイプがないため、IClassType.PropertyNameを実装できません。
さて、コードについて:
public class ClassName : IClassType
{
public IChildPropertyType PropertyName { get; set; }
}
public interface IClassType
{
public IBasePropertyType PropertyName { get; set; }
}
public interface IBasePropertyType
{
// some methods
}
public interface IChildPropertyType : IBasePropertyType
{
// some methods
}
私が試みていることを行う方法はありますか?問題が共変性/反変性にあることは知っていますが、これを行う方法がわからないようです。