【发布时间】:2012-07-15 12:43:43
【问题描述】:
我的项目中需要有多个表单类。因此正在考虑将这些形式共有的所有内容放在抽象类中。该类将具有继承的 Form 类和一个接口。那样的东西:
public interface IMyForm
{
void Init();
}
public abstract class AMyForm : Form, IMyForm
{
void IBrowser.Init()
{
throw new NotImplementedException();
}
}
public partial class MainClass : AMyForm
{
// But here the warning is shown (That i have to add override keyword),
// but when i do, The error is shown that i cannot override from non abstract thing
public void Init()
{
}
}
你能告诉我如何实现吗?
【问题讨论】:
标签: c# winforms interface abstract-class