#include using namespace std ; class A1 { }; //-------------------------------------------------------- int main() { int x1 = 27; // x is an int const int cx = x1; // cx is a const int const int& rx = x1; int& lvalueRef = x1 ; int* ptr1 = &x1 ; const int* ptrc1 = &x1 ; decltype( x1 ) x2 =10 ; cout << typeid( x2 ).name() << endl ; //typeid does not give information about //constant qualifiers decltype( cx ) cx1 =10 ; //cx1 is of type const int cout << typeid( cx1 ).name() << endl ; decltype( rx ) rx1 =10 ; // rx1 is of type const int& if a reference is constant then // we can assign a rvalue to it cout << typeid( rx1 ).name() << endl ; decltype(lvalueRef) lvalueRef1 = x1 ; //need to initialize it here as lvalueRef1 is of type int& A1 Obj1A ; decltype(Obj1A) Obj2A ; //Obj2A is of type A1 auto rx2 = rx1 ; //auto does not retain the const //rx2 is of type int decltype( auto ) rx3 = rx1 ; //The above syntax is stating that //rx3 is of type const int& return 0 ; } //--------------------------------------------------------