The process of selecting the appropriate method based on an object’s type is called
binding. If the determination of an object’s type can be deferred until runtime (rather than
compile time), the selection is called dynamic (late) binding. For example, consider the
class hierarchy of Staff with subclasses Manager and SalesStaff shown in Figure 25.5, and
assume that each class has its own print method to print out relevant details. Further assume
that we have a list consisting of an arbitrary number of objects, n say, from this hierarchy.
In a conventional programming language, we would need a CASE statement or a nested
IF statement to print out the corresponding details: