Type Information

This lesson describes techniques for obtaining the type of an entity.

We'll cover the following...

typeid #

We have seen numerous instances of the typeid operator in this course. It can be used to retrieve the type of a variable or object at runtime. Because of this, it works well with pointers.

To use typeid, we must include the <typeinfo> header. The operator returns a type_info object that has various methods of its own. ...