Can I force subclasses to override a method without making it abstract?

前端 未结 7 629
别那么骄傲
别那么骄傲 2021-01-02 12:22

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

7条回答
  •  别那么骄傲
    2021-01-02 12:23

    I know its not quite what you are after but you could make all of your stubs in the base class throw the NotImplementedException. Then if any of your subclasses have not overridden them you would get a runtime exception when the method in the base class gets called.

提交回复
热议问题