条款10:令operator=返回一个refereglce to this
2017-08-07 23:01
281 查看
// 条款10: 令operator=返回一个reference to *this。 // Have assignment operators return a reference to *this. // 这只是个良好的建议,这个建议被所有的内置类型和标准程序库提供的类型共同遵守。 // 这个建议同样适用于+=,-=,*=等等。 // 例如: class Widgets { public: Widgets& operator+=(const Widgets& widgets) { // 实现 return *this; } Widgets& 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
- 条款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
- 读书笔记《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-11:令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
- 【effective c++】条款10:令operator=返回一个reference to *this