Member functions the compiler writes for you
Question
If you write an empty class in C++, which member functions does the compiler supply automatically?
Short answer
A default constructor, copy constructor, copy-assignment operator and destructor; since C++11 also a move constructor and move-assignment operator. Each is generated only when used and not suppressed: declaring any constructor removes the default one, and declaring a destructor or copy operation suppresses the implicit move operations.
Adapted from Joshi, Denson & Downes, Quant Job Interview Questions and Answers, Q7.14, 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