void func(const int &b){ b=1000;// cout << b << endl; } int main(){ int a =10; //const int &b = 10; //10是一个常量 int a =10 实际是 const int &b = 10; int &b = a; func(a); return 0; }
标签:常量,形参,C++,引用,修饰,误操作 From: https://www.cnblogs.com/itniwota/p/16852927.html