条款10:令 operator= 返回一个reference to *this
int x, y, z;
x = y = z = 15; // x = (y = (z = 15)));class Widget {
public:
...
Widget& operator=(const Wedget& rhs) {
...
return *this;
}
...
};Last updated
int x, y, z;
x = y = z = 15; // x = (y = (z = 15)));class Widget {
public:
...
Widget& operator=(const Wedget& rhs) {
...
return *this;
}
...
};Last updated