lAll methods are bound in Java using run-time
dynamic binding
•Unless the method (or
class) is “final”
•So, we can
use upcasting as we did in C++ to produce desired dynamic
binding effects:
•list
obj = new ordered_list();
•Here, an ordered list object is
created and the reference is assigned to a list reference
•obj.display(); //won’t call List’s display but rather ordered_lists!