| Dynamic Method Dispatch - Example Code Abstract Class : Overriding Abstract Method in Child Class : Dynamic/Late Binding leads to Dynamic method dispatch : Result : Upcasting : - Dynamic Binding = Late binding
- Abstract classes cannot be instantiated, but they can be sub-classed (Base for a child class)
- An abstract method is a method that is declared without an implementation
- Abstract class may contain a mix of methods declared with or without an implementation
- When an abstract class is sub-classed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, then the subclass must also be declared abstract
- Dynamic method dispatch is a mechanism by which a call to an overridden method is resolved at runtime. This is how java implements runtime polymorphism.
- Upcasting : Casting a subtype to a supertype, upward to the inheritance tree.
- Runtime Polymorphism = Dynamic Polymorphism
|