當(dāng)前位置:
首頁 >
C++ 常量引用
發(fā)布時(shí)間:2025/3/15
37
豆豆
#include<iostream>
#include<string>
using namespace std;int main() {//常量引用//使用場(chǎng)景:用來修飾形參,防止誤操作//int a = 10;//加上const之后編譯器將代碼修改int temp = 10; const int & ref = temp; const int & ref = 10;//引用必須引一塊合法的內(nèi)存空間ref = 20; //加入const之后變?yōu)橹蛔x,不可以修改system(" pause");return 0;}
總結(jié)
- 上一篇: oracle多线程类连接数,数据库连接数
- 下一篇: C++ 通讯录设计(三)