我需要在我的项目中有多个表单类。所以考虑将这些形式共有的所有东西放在抽象类中。该类将具有继承的 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()
{
}
}
你能告诉我如何实现吗?