Initializing reference member variable with literal
问题 In the following code , I am initializing a reference variable with a literal. class ABC { public: const int& a; ABC():a(43) { } void newfoo() { printf("NEWFOO %d",a); } }; int main() { ABC obj; obj.newfoo(); } The output of this program is NEWFOO 32767 which seems illogical when I know that the following code works just fine. int main() { const int& b=3; printf("%d",b); } What is happening here ? If compiler declares some temp variable during initializing of the reference variable , then isn