[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppTypeid
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppTypeid
(C++) typeid
Keyword used to check the data type at run-time.Example
This example shows the name of a base and derived class.struct Base { }; struct Derived : public Base { }; int main() { Base base; Derived derived; std::cout << typeid(base).name() << std::endl; std::cout << typeid(derived).name() << std::endl; }
- include <iostream>
- include <typeinfo>
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
