the rule of zero / rule of five
These are not language rules the compiler enforces — they are battle-tested guidelines for how to handle the special member functions consistently, so your types copy, move, and clean up correctly. The headline advice is the rule of zero: design your classes so you don't have to write any of those functions at all. If every member is itself a well-behaved RAII type (a std::vector, a std::string, a std::unique_ptr), the compiler-generated copy, move, and destruction already do the right thing, and the safest code is the code you never wrote.
When you genuinely must manage a raw resource yourself — a file handle, a C library pointer, a chunk of memory — the rule of five kicks in: if you have to write any one of the destructor, copy constructor, copy assignment, move constructor, or move assignment, you almost certainly need to think about all five, because they form one coherent story about ownership. The older rule of three was the pre-C++11 version covering just the destructor and the two copy operations; the move pair was added to make five. The reasoning is simple: the moment you write a custom destructor that, say, calls free(), the default memberwise copy becomes wrong (it would copy the pointer and double-free), so you must define copy and move to match.
Why it matters: this is the difference between leak-free, crash-free resource code and the classic double-free / dangling-pointer bugs. The modern best practice is to push the rule of five down into small single-resource wrapper classes (or just use the standard library's) and let everything above them follow the rule of zero. The honest nuance: writing any of the five suppresses the compiler's generation of some others — so the rule of five is partly defensive, making sure no operation silently goes missing or silently degrades a move into a copy.
class Good { std::unique_ptr<int[]> data; std::string name; }; // rule of zero: no special members written, all correct by default
Because every member is RAII, copy/move/destroy are correctly generated for free — the ideal modern design.
There is also a rule of three-and-a-half and a 'rule of six' counting the default constructor; the names matter less than the principle. The real rule: ownership of a resource must have exactly one coherent answer across construction, copy, move, and destruction.