Does a subclass need its own operator=
Question
A base class defines its own copy-assignment operator. Must every derived class define one too?
Short answer
No. The compiler-generated assignment in the derived class calls the base class's operator and then assigns each derived member. You only need your own if the derived members need special handling (for example owned raw memory), and then you must explicitly call Base::operator= inside it or the base part will not be copied.
Adapted from Joshi, Denson & Downes, Quant Job Interview Questions and Answers, Q7.7, p.226; question and answer rewritten by SelfMadeQuant.com.
See the hint and the full worked solution in the question bank (free account).
Open the worked solution