有没有办法让继承了一个含有接口的基类的成员来实现该接口。
一些接口
public interface ICanWork
{
void DoSomething();
}
一个抽象类
public abstract Class MyBase : ICanWork
{
// I do not want to implement the ICanWork but instead want the derived class which inherit it
}
我继承基类的类
public class House : MyBase
{
// i want the compiler to know that it needs to implement ICanWork
}
这个并没有按照我的预期工作。
实现这个的唯一方法是将接口放在继承基类的类上吗?
例如:
public class House : MyBase, ICanWork
{
}
有什么有用的建议吗?