html RTTI - Run Time Type Information

RTTI - Run Time Type Information

typeid.cpp a program which demonstrates the typeid operator.

bad_cast.cpp This program demonstrates the use of the dynamic_cast operator. It orignally compiled but didn't link because the functions A::f, and B::g weren't defined. This caused a linker error "undefined reference to typeinfo for A". This is similar to the notorious error, "undefined vtable for class A".

bad_cast2.cpp This program demonstrates the use of the dynamic_cast operator. It was take from ???.

typeid.cpp This program demonstrates the typeid operator. It also demonstrates how to generate a bad_type exception by calling typeid with a null pointer to a polymorphic class (ie. a class with a vtable).

typid.poly.cpp This program demonstrates the typid operator on a variety of polymorphic classes. It shows that the typid operator is accessing the vtable, to see the true type of the pointer, rather than the apparent type.

RTTI.mwc and RTTI.mpc are the build files for make project creator, to build all of the previos programs.