这个主要的点是,赋值可以写成连锁形式:
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;
}
//...
};