Showing posts with label upcasting. Show all posts
Showing posts with label upcasting. Show all posts

Tuesday, 21 January 2014

Using Dynamic Method Dispatch in java

 how to use dynamic method dispatch:method overriding


Dynamic Method Dispatch

Method overriding forms the basis for one of Java’s most powerful concepts: dynamic method dispatch. Dynamic method dispatch is the mechanism by which a call to an overridden method is resolved at run time, rather than compile time. Dynamic Method Dispatch is related to a principle that states that an super class reference can store the reference of subclass object. However, it can't call any of the newly added methods by the subclass but a call to an overridden methods results in calling a method of that object whose reference is stored in the super class reference.