Published Aug 03, 2019
[
 
]
The rule of three and rule of five and rules of thumb in C++ for the building of exception-safe code and for formalizing rules on resource management. It accomplishes this by prescribing how the default members of a class should be used to accomplish this task in a systematic manner.
The rule of three is a rule of thumb in C++ (prior to C++11) that claims that if a class defines one (or more) of the following it should probably explicitly define all three:
With the advent of C++11 the rule of three can be broadened to the rule of five as C++ implements move semantics.
References: https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)