effective c++ 条款10 让operator= 返回*this的引用

如:x = y = z;我们想实现这样的“连锁赋值”在我们的类里应该定义一个operator=的函数并且返回一个*this指针。

widget& operator= (const widget& rhn)
{
    
    ....
    return *this;
}

 

posted @ 2013-05-07 20:34  onlycxue  阅读(396)  评论(1编辑  收藏  举报