21.5 Obtaining Run-Time Typing Information (RTTI)

2 common ways to obtain the dynamic type of an object:

  1. dynamic cast - for casting down the inheritance hierarchy, checking for success
  2. Using the type_id operator to compare a dynamic type to a known type

Warning: use virtual methods instead of RTTI and complex conditionals


prev |top |next