Late (Dynamic) BindingΒΆ

A subclass can replace the implementation of an inherited function with an implementation of its own. In C++ the possibility to do this is offered by defining the function in the base class as virtual (keyword virtual). In Java functions in the interface by default allow the inheriting subclass to implement them the way it sees fit. This and polymorphism together mean that the implementation that needs to be called for the function can be lower down the inheritance hierarchy. The compiler cannot in these situations necessarily determine from which class the implementation should be called. The decision is made at runtime instead. This is called late or dynamic binding. Late binding makes it possible that the same function call can call functions in different objects. The function call behaves differently depending on which class the object it was called for belongs to. Java uses late binding for all public class methods not marked final.

Polymorphism and late binding (duration 11:04)

Posting submission...