Dynamic Method Dispatch

Dynamic Method Dispatch (RunTime Polymorphism):

  • A superclass reference can refer to a subclass object. Whenever an overridden method is called through that superclass reference, then the call to that overridden method is resolved at run time based on the object being referred by the superclass reference.

Example:

Output:

B
C





Share this website !!!
Facebook Twitter Linkedin