How many constructors are in the person class above?
Yeah, Five but your instructor will want you to say 3 because only 3 are explicitly defined.
The other 2 (copy constructor and move constructor) are created by the compiler as long as there is no definition of a
- copy ctor
- move ctor
- copy-assignment operator
- move-assignment operator
- destructor
Since none of those are defined in your class the copy ctor and the move ctor will be implicitly created by the compiler.
Move ctor and move assignment operator were added in C++11. before that they just fall out of that list.