Dynamic Binding and Polymorphism

Another key concept that allows you to write generic programs is dynamic or late binding. Dynamic binding allows a member function call to be resolved at run time, according to the run-time type of an object reference. This permits each user-defined class in an inheritance hierarchy to have a different implementation of a particular function. Application programs can then apply that function to an object without needing to know the specifics of the class that the object belongs to.

In C++, dynamic binding hides the differences between a group of classes in an inheritance hierarchy from the application program. At run time, the system determines the specific class of the object and invokes the appropriate function implementation for that class.

Dynamic binding is distinguished from static or compile-time binding, which involves compile-time member function resolution according to the static type of an object reference.



C++ Classes
Encapsulation
Inheritance Overview
Inheritance
Scope of Identifier Visibility in C++


Virtual Base Classes
Scope Resolution Operator ::