c++重载运算符参数写法问题
巴扎黑
巴扎黑 2017-04-17 15:27:46
0
1
422

这里为啥要这样写?啥意思?求解,谢谢^^

巴扎黑
巴扎黑

reply all(1)
Peter_Zhu

"&" uses references as parameters to reduce the cost of copy construction.
Because addition does not need to change the original value, and it must be able to accept const objects, so add const.
In fact, for such a small class, the cost of copy construction is negligible, and there is no need to use reference to pass value.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template