This paper has presented a run-time type information (RTTI) system which lets the programmer add several features to any application class: textual type name information, generic type management via typeids, run-time pointer casting for any combination of pointer type and target type and type instantiation from run-time specified typeids.
The RTTI system adds only a minimal overhead to application classes
(a few virtual and static methods and a small static object per application
class). The system is guaranteed to work correctly in any C++ application
compiled with a C++ compiler which follows the basic language specifications.
Moreover, an application planning to use RTTI has to perform only minor
modifications (add two keywords, one per class declaration and one per
class definition). As any C++ library, the RTTI system introduces a few
new indentifiers, in the global scope as well as in each application class
which uses RTTI. We have attempted to minimize name clashes by using private
declarations where applicable or prefixing the global indentifiers with
.
The presented system is incremental, i.e. the features it offers can be added separately starting from the simplest to the most complex (i.e. from textual type names, continuing with typeids and typeid operations, pointer casting and ending with run-time object creation).
The features offered by the system are also incremetal, i.e. they can be used independently of each other, starting with the simplest and ending with the most involved ones. Programmers can therefore understand only those features that their particular applications need.