Hello everyone,
Could anyone explain the below please?
I know that typeid class has private assignment operator so you cannot assign anything to it. But I see with the below code it is possible to have a const reference to it via assignment operator.
1 2 3 4 5 6 7 8 9
#include <iostream>
#include <typeinfo>
usingnamespace std;
int main (){
//type_info t=typeid(int); // does not works
const type_info &t= typeid(int); // works
cout<<t.name();
}