首页 > 编程语言 > 详细

C++运算符重载

时间:2017-07-24 17:21:09      阅读:227      评论:0      收藏:0      [点我收藏+]

可看一博主文章http://blog.csdn.net/insistgogo/article/details/6626952

 

下面是自+1的函数重载

//单目运算符重装++, --
Person& operator++() //++a;
{
this->age += 1;
return *this;
}

Person operator++(int) //a++
{
Person old(*this);
this->age += 1;
return old;
}

C++运算符重载

原文:http://www.cnblogs.com/kirk1995/p/7229729.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!