Run-Time Type Information and Casting
We saw in the previous chapter that similar classes can be placed in a class hierarchy, with numerous classes derived from a single base class. Working in terms of a pointer to the base class, rather than objects of the derived classes, we are able to operate on functions common to all derived classes via a single pointer object that can point to any derived class object. Such a runtime capability is essential to object-oriented programming, but unfortunately moves us away from the strongly typed compile-time mechanism so characteristic of the C++ language.
Unable to display preview. Download preview PDF.