October 1997
Intermediate to advanced
800 pages
20h 48m
English
This section examines several applications with RTTI. We'll show you how RTTI determines object types in class hierarchies, extends class libraries for new classes, and controls object behaviors. These applications demonstrate the power of RTTI and its important role as a portable solution to class library design.
This example applies RTTI to the Shape class hierarchy from Chapter 11 (Listing 11.23 on page 531). We'll start with the Shape abstract base class.
class Shape { // abstract base private: static int count; // static data member public: Shape() { count++; } // constructor Shape(const Shape &) { count++; } // copy constructor virtual ~Shape() ... |