cpp get type of object code example
Example 1: get type of an object c++
//get type of a
typeid(a).name()
Example 2: c++ get type name of object
#include <iostream>
int main() {
int myNum;
std::cout << typeid(myNum).name();
return 0;
}
//get type of a
typeid(a).name()
#include <iostream>
int main() {
int myNum;
std::cout << typeid(myNum).name();
return 0;
}