Jump to content

C++: Difference between revisions

Line 659: Line 659:
If you need any from one of the rules, you need to implement the remainder
If you need any from one of the rules, you need to implement the remainder


Rule of zero<br>
;Rule of zero<br>
Do not use a custom deconstructor, copy constructor, or copy assignment. Push all of these operations into the classes of member variables such as <code>std::vector</code> and <code>unique_ptr</code>. This is the best and simplest case.
Do not use a custom deconstructor, copy constructor, or copy assignment. Push all of these operations into the classes of member variables such as <code>std::vector</code> and <code>unique_ptr</code>. This is the best and simplest case.


[[Wikipedia: Rule of three (C++ programming) | Rule of three]]
;[[Wikipedia: Rule of three (C++ programming) | Rule of three]]
* Destructor
* Destructor
* Copy constructor
* Copy constructor
* Copy assignment operator
* Copy assignment operator


[[Wikipedia: Rule of three (C++ programming)#Rule of five | Rule of five]]
;[[Wikipedia: Rule of three (C++ programming)#Rule of five | Rule of five]]
* All from rule of three plus:
* All from rule of three plus:
* Move constructor
* Move constructor