Introduction to OOP | Chapter 11: Static and Dynamic Behavior: | next | previous | audio | real | text |
The task of reverse polymorphism is often encountered in connection with a collection of values - we have a list of items from the parent class (say a list of Mammals), and when we extract a value we need to know if it is a more specific type.
Generally occurs in languages with a single inheritance tree, where the only type we may have associated with a value is the class ``Object''.
Solving this problem generally requires values to have ``self knowledge'' of their own type. In some languages they do, in some languages values do not.