Code: Select all
#include<iostream.h>
class yourclass { };
int main()
{
int i;
float j;
char c;
double db;
yourclass a;
cout << " i is " << typeid(i).name() << endl;
cout << " j is " << typeid(j).name() << endl;
cout << " db is " << typeid(db).name() << endl;
cout << " c is " << typeid(c).name() << endl;
cout << " a is " << typeid(a).name() << endl;
return 0;
}
Now how come the name of the user defined type (myclass) is printed (in full) whereas the standard datatypes are just one char?i is i
j is f
db is d
c is c
a is 9yourclass
What is the reason behind this?