29.9 Run Time Type Identification
The typeid
function returns information about
the type of an expression. The result is of type
std::type_info. This class contains the member
function name( ) and returns the name of the type.
For example:
type_info info = typeid(1.0 + 2);
std::cout << "Result is of type " << info.name( ) << endl;
|