Casting Operators
Run-Time Type Identification
(RTTI)
• Added to provide enhanced support for run-time
polymorphism.
• To identify the type of an object during the
execution of program.
• Reason for req:
– Because of polymorphism, the precise nature of that
object is not determined until the program is
executed.
– base-class pointers may be used to point to objects of
the base class or any object derived from that base
• object's type can be obtained using typeid.
• Prototype:
– typeid(object)
Animals generated:
Dogs: 2
Cats: 4
Platypuses: 4
typeid in Template Classes