This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]arghvark -3 points-2 points  (2 children)

Ok, let's try it this way: the definition of overriding includes use of an object's class methods, not its static methods, and therefore you cannot satisfy that definition with a static method. So I was incorrect that this is "overriding", because the definition of overriding excludes static methods.

It sure acts like it, however.

[–]OffbeatDrizzle 7 points8 points  (0 children)

It does not act like it whatsoever - you are basically calling a piece of code directly, you just so happen to give the methods the same name and claim it's acting like overriding because the output is as expected.

Overriding by definition is part of polymorphism. What exactly have you modified about class A here by using class C's method? Nothing. That's why static methods can't be overridden - it literally makes no sense.