赋值重载的约定(1)
摘要:
为了实现连锁赋值,赋值操作符必须返回一个引用指向左侧实参。(约定俗成) int x,y,z; x=y=z=20; so: weight& operator=(const weight& a) { ........... return *this;//返回左侧对象 } 注意:这只是一个协议,并无强制性 阅读全文
posted @ 2017-04-07 21:31 邗影 阅读(159) 评论(0) 推荐(0) 编辑
posted @ 2017-04-07 21:31 邗影 阅读(159) 评论(0) 推荐(0) 编辑
posted @ 2017-04-07 21:22 邗影 阅读(244) 评论(0) 推荐(0) 编辑