123456789101112131415161718192021222324252627
class Test { public: int a; Test() : a(0) {} Test(int x) : a(x) {} Test& operator=(const Test& rhs) { if(this == &rhs) return *this; a = rhs.a; return *this; } }; int main() { Test t(5); Test t2; Test t3; t3 = t2 = t; cout << t3.a << endl; cout << t.a << endl; return 0; }