//int &ref = 10; 引用了不合法的内存,不可以
const int &reff = 10; 加入const后编译器处理方式为: int tmp = 10; const int &ref = tmp;
int *p = (int*)&ref;
*p = 1000; 合法内存,可以修改
常量引用使用场景 用来修饰形参
void ShowValue(const int &val)
{
//val++; 报错,不能改
cout<<val;
}