读书笔记《Effective c++》 条款10 令operator= 返回一个reference to *this
2018-01-09 09:49
381 查看
这个主要的点是,赋值可以写成连锁形式:
int x, y, z;
x = y = z =15;
class Widget
{
public:
Widget& operator+=(const Widget& rhs)
{
//...
return *this;
}
Widget& operator=(int rhs)
{
//...
return *this;
}
//...
};
int x, y, z;
x = y = z =15;
class Widget
{
public:
Widget& operator+=(const Widget& rhs)
{
//...
return *this;
}
Widget& operator=(int rhs)
{
//...
return *this;
}
//...
};
相关文章推荐
- 读书笔记《Effective C++》条款10:令operator=返回一个reference to *this
- 《Effective C++ 》条款10:令operator=返回一个reference to *this
- effective C++ 10_令operator=返回一个reference to *this 读书笔记
- effective C++ 条款 10:operator= 返回一个reference to *this
- Effective C++ 条款10解读: 令operator= 返回一个reference to *this
- Effective C++ 条款10: 令operator= 返回一个reference to *this
- 【effective c++】条款10:令operator=返回一个reference to *this
- 《Effective C++》学习笔记条款10 令operator= 返回一个reference to *this
- Effective C++:条款10:令operator=返回一个reference to *this。
- Effective C++ -----条款10: 令operator=返回一个reference to *this
- Effective C++ 条款10:令operator= 返回一个reference to *this
- 条款10:令operator=返回一个reference to *this
- 条款10:令operator=返回一个reference to * this
- Effective C++ 10 令operator=返回一个reference to *this 笔记
- 条款10:令operator= 返回一个reference to *this
- 条款10:令operator=返回一个reference to *this
- 条款10:令operator=返回一个reference to *this
- 条款10 令operator=返回一个 reference to *this
- 读书笔记_Effective_C++_条款十:令operator=返回一个reference to *this
- Effective C++——》条款10:令operator=返回一个reference to *this