Hello.
Can static methods be overridden?
I wrote simple code to
test. Given that the declaration type of the reference and the object are both of the subclass type:
<subclass type> var = new <subclass type>(), the static method was overridden from its superclass. However, using dynamic method binding where:
<superclass type> var = new <subclass type>(), the static method from the superclass was called instead of the one in the subclass.
For instance methods. The overriding methods in the subclass during dynamic method binding, as expected, was called.
I first had the impression if you can inherit it, then you can override it. Is this true for static methods?
Here's the code i used:
thanks.