更新时间:2022-03-03 08:24:56
虚拟静态方法没有意义.如果我调用 HelperClass.HelperMethod();
,为什么我会期望调用一些随机子类的方法?当您有 HelperClass
的 2 个子类时,解决方案真的会崩溃——您会使用哪一个?
Virtual static methods don't make sense. If I call HelperClass.HelperMethod();
, why would I expect some random subclass' method to be called? The solution really breaks down when you have 2 subclasses of HelperClass
- which one would you use?
如果您想拥有可覆盖的静态类型方法,您可能应该使用:
If you want to have overrideable static-type methods you should probably go with:
选择最适合您情况的解决方案.
Choose whichever solution makes more sense in your situation.