trønderen wrote:
class objects (instances), the compiler adds another "semi-hidden" field to hold a reference to the class definition object. The class definition is present at run time, and may be interrogated. The class definition is the type of the class instances.
With the small caveat that classes need at least one virtual function to get this RTTI (Run-Time Type Information). Classes without virtual function members don't get this vtable member. Pretty sure this is standard required behavior, but I haven't checked. It is true however at least in the case of MSVC, the compiler I know best.
Mircea (see my latest musings at neacsu.net)