Ive saw the next paragraph in some computer science test and i’ll hope i can get here a good explanation of what it means because i googled it for an hour and can’t find anything..
“When we say Java language has virtual method calling we mean that in java applications the executed method is determined by the object type in run time”
What does it mean? can anyone explain it better?
The author of these lines used the c++ terminology of
virtual.A better terminology is dynamic binding / dynamic dispatch.
That means, that the object’s dynamic type is “chosing” which method will be invoked, and not the static type.
For example: [pseudo code]:
when invoking:
B.foo()will be invoked, and NOTA.foo(), since the dynamic type ofobjisB.