Statically bound definitions are hidden in the sub-class by a new definition with the same name. This is the familiar scope rule used in Pascal when nested procedures are declared. Any use of the name in the parent class is still bound to the definition within that class, which means that its use must be as was intended by the writer of that class. Uses within a sub-class where it is redefined and within any classes which are sub-classes of that are bound to the definition in the sub-class.
Dynamically bound definitions (virtual definitions) are also hidden in the sub-class by a redeclaration at that level. However, they are replaced in the parent class as well. This is very useful where, for instance, a family of object types all have the ability to be displayed but the effect of this differs for each of them. By noting in the parent class that such an operation is mandatory and that it has a certain form, we are free to use it in the parent class and assume each specialisation will provide an over-riding definition which replaces it when used. In some languages the parent class need not provide a default implementation, in others it must always do so.
Most languages in common use have adopted a variation of SIMULA's combination of default static binding with an explicit option to make certain operations dynamically bound. C++ is one of these and uses the virtual specifier to indicate dynamic binding.
Back to index