【发布时间】:2017-02-25 08:15:39
【问题描述】:
public class Schedule_Action : MonoBehaviour
{
public List<Action> mondaySchedule = new List<Action>();
public virtual List<Action> MondaySchedule
{
get { return mondaySchedule; }
}
}
public class Schedule_ActionHire : Schedule_Action
{
//causes an error here saying it should match overriden with Action
public override List<Action_Adventure> MondaySchedule
{
get
{
return mondaySchedule.Cast<Action_Adventure>().ToList();
}
}
}
“Action_Adventure”是“Action”的子级。
有没有办法绕过这个错误?或者可能是与上面给出的代码具有相同逻辑的另一种方式?
【问题讨论】:
标签: c# unity3d game-engine