引用的本质 本质:引用的本质在C++内部实现是一个指针常量 #include <iostream> using namespace std; int main() { int num = 100; //自动转换为 int* const ref = # 指针常量是指针指向不可更改,也说明为什么引用不可更改 int& ref = num; ref = 20; //内部发现ref是引用,自动帮我们转换为:*ref = 20; cout << "num:" << num << endl; cout << "ref:" << ref << endl; return 0; }