条款十 令 operator = 返回一个 reference to *this

条款九跳过了,里面的内容和我看到的内容有些出入,所以跳过

条款十  令operator = 返回一个 reference to *this

赋值操作=有时候用于连续的赋值操作,为了类能够连续赋值,并且高效完成
可以使用 reference,重载操作符时,令返回值为reference *this
class Test
{
public:
Test& operator = (const Test& obj)
{
......
return *this;
}
}

可以使用所有的相关的运算操作符

原文地址:https://www.cnblogs.com/bizhu/p/2612092.html