effective c++ 条款10 handle assignment to self operator =

时间:2014-07-06 16:14:49   收藏:0   阅读:264

非强制性,但是个好习惯

当使用连锁赋值时很有用

x=y=z=10;

class Window
{
  public:
    Window& operator=(int size)
    {
     ...
     return *this;
    }
}

这个规则适用于 -,+, +=,-= etc 

effective c++ 条款10 handle assignment to self operator =,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!