seetharaman venkatasamy wrote:
Siva Masilamani wrote:the determination of which overridden method to execute isn't made until runtime
Once again, i tell you.it is not an Overriding.still you need to change your sentence
That sentence is not particular for his program.
It is in general that overriden method will be resolved at runtime and overloaded method will be resolved by the compiler,that is compiler knows which overloaded method to be called.
So in his program it is overloaded and hence the method call is based on reference not on actual object
To put it in simple words.
If method is overloaded check the reference and if the method is present then no error and the method will be called based on reference.
If the method is overriden check the reference and if the method is present on that reference then no error but the method call will be based on object at runtime not on reference type.
The above conditions hold good only for instance method not for class method.
Also any variable(class or instance) always refered with reference type not on object type.
Hope it clears everyone confusion