Effective C++ 条款10 令赋值操作符operator=返回一个引用,指向*this

来源:互联网 发布:linux链接目的 编辑:程序博客网 时间:2024/05/10 03:50

请记住:

令赋值操作符operator=返回一个引用,指向*this令赋值操作符operator=返回一个引用,指向*this

 

例如

Base& operator=(const Base & b){if (this==&b)return *this;.....return *this;}



 

0 0
原创粉丝点击