码迷,mamicode.com
首页 > 其他好文 > 详细

const reference

时间:2017-04-24 22:59:45      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:reference   return   

void main(){

int a=3;

const int f=4;

//int &g=f;不可把常量赋给int型引用

//int &c=3;不可把常量赋给int型引用

int &b=a;

const int &d=3;//可以给常量引用赋以常量。

const int &e=a;

a++;//a可以修改

//e++;但是定义为常量引用的e就不可以修改。

return ;

}


const reference

标签:reference   return   

原文地址:http://ji123.blog.51cto.com/11333309/1918891

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!