Why we can not override static method?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at Google, Lives in Mountain View, CA
Static methods cannot be overridden because method overriding only occurs in the context of dynamic (i.e. runtime) lookup of methods. Static methods (by their name) are looked up statically (i.e. at compile-time). Method overriding happens in the type of subtype polymorphism that exists in languages like Java and C++.
2023-06-14 06:42:31
评论(499)
Helpful(122)
Helpful
Helpful(2)

Charlotte Cooper
QuesHub.com delivers expert answers and knowledge to you.
Static methods cannot be overridden because method overriding only occurs in the context of dynamic (i.e. runtime) lookup of methods. Static methods (by their name) are looked up statically (i.e. at compile-time). Method overriding happens in the type of subtype polymorphism that exists in languages like Java and C++.