Can I force subclasses to override a method withou

2019-02-09 12:18发布

I have a class with some abstract methods, but I want to be able to edit a subclass of that class in the designer. However, the designer can't edit the subclass unless it can create an instance of the parent class. So my plan is to replace the abstract methods with stubs and mark them as virtual - but then if I make another subclass, I won't get a compile-time error if I forget to implement them.

Is there a way to mark the methods so that they have to be implemented by subclasses, without marking them as abstract?

7条回答
可以哭但决不认输i
2楼-- · 2019-02-09 12:47

Note that "DesignMode" is not set in the constructor. It's set after VS parses the InitializeComponents() method.

查看更多
登录 后发表回答