29.9 Run Time Type Identification

I l @ ve RuBoard

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; 
I l @ ve RuBoard


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net