y****I 发帖数: 86 | 1 my first one and I think I screwed it. (with GS)
anyway, they told me that's 30 minutes, but it took 55 minutes instead.
two questions I didn't get:
1.
void function1(const TestClass& iclass)
}
}
what if you want to change some fields in iclass with the same interface?
2. I should have got this one, but ...
what else need to be considered in the overloaded assignment operator
compared with copy constructor.
got the answer after his hint. | z***i 发帖数: 212 | 2 1, use const_cast to cast away constness.
2, avoid self assignment
【在 y****I 的大作中提到】 : my first one and I think I screwed it. (with GS) : anyway, they told me that's 30 minutes, but it took 55 minutes instead. : two questions I didn't get: : 1. : void function1(const TestClass& iclass) : } : } : what if you want to change some fields in iclass with the same interface? : 2. I should have got this one, but ... : what else need to be considered in the overloaded assignment operator
|
|