typedef void* ClassID

ClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ compilers

Documentation

ClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ compilers. Each class hierarchy which needs to implement polymorphic clone() or operator==() defines two methods, described in detail below. ClassID values can be compared using operator==(). Nothing else should be done with them. getDynamicClassID() is declared in the base class of the hierarchy as a pure virtual. Each concrete subclass implements it in the same way: class Base { public: virtual ClassID getDynamicClassID() const = 0; } class Derived { public: virtual ClassID getDynamicClassID() const { return Derived::getStaticClassID(); } } Each concrete class implements getStaticClassID() as well, which allows clients to test for a specific type. class Derived { public: static ClassID getStaticClassID(); private: static char fgClassID; } // In Derived.cpp: ClassID Derived::getStaticClassID() { return (ClassID)&Derived::fgClassID; } char Derived::fgClassID = 0; // Value is irrelevant

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de