Skip to content
UPEEC

Rule of Zero, Three and Five

If a class manages a resource, define all special members (Five); better, let members manage it and define none (Zero).

Intermediate
Comments 0

Rule of Three (pre-C++11): destructor, copy constructor, copy assignment. Rule of Five adds move constructor and move assignment.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.