我有一个void Action()在派生类中重写的虚基本方法.
void Action()
行动的第一步是打电话base.Action().如果基本方法中出现某种情况,我不希望处理其余的派生方法.
base.Action()
我想知道是否有一个关键字或设计模式,允许我从基本方法退出派生方法.
目前我正在考虑将void更改为bool并将其用作流控制,但我想知道是否有任何其他设计模式我可以使用.
c# methods inheritance derived base
base ×1
c# ×1
derived ×1
inheritance ×1
methods ×1