Is it possible to override a static method in derived class?

后端 未结 7 1622
暗喜
暗喜 2020-11-28 13:33

I have a static method defined in a base class, I want to override this method in its child class, is it possible?

I tried this but it did not work as I expected. Wh

相关标签:
7条回答
  • 2020-11-28 14:34

    In a nutshell static method overriding is not polymorphism it is "method hiding". When you override a static method you will have no access to the base class method as it will be hidden by the derived class.. Usage of super() will throw a compile time error..

    0 讨论(0)
提交回复
热议问题