Static methods are not polymorphic. That means that the compiler decides what method to call at compile time based on the static type of the reference. Since you're calling the method via a reference of type "Fig", the compiler hard-codes "Fig.show()" into the class file. No dynamic lookup is done at runtime.
When you redefine a static method in a subclass, you're merely "hiding" the base class's method -- you're not overriding it, because the term "overriding" implies polymorphic behavior.
Are Static methods inherited ? , i think they are but why. Static methods / variables are class property and not object property,then why are inherited .
Originally posted by Neha Mohit: Static methods / variables are class property and not object property,then why are inherited .
What does the first have to do with the second in your opinion?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Neha Mohit
Ranch Hand
Joined: Apr 25, 2006
Posts: 87
posted
0
Originally posted by Ilja Preuss:
What does the first have to do with the second in your opinion?
I think , class property should be specific to the class.
regards
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
posted
0
Originally posted by Neha Mohit: I think , class property should be specific to the class.
Well, I guess from a purely philosophical point of view, you might be right.
But the more important question to answer for me is: would it make the live of the programmer easier or harder?