Rule Definition
If you need an assignment operator, you also need a destructor and copy constructor. If you need an assignment operator, it's because you need something like a deep copy, or some other management of resources. Thus it is almost certain that you will need a destructor and a copy constructor.
If you don't need an assignment operator (because the default-generated assignment operator would be correct), you should let the compiler generate it: tt will not contain bugs, and you will often not have to update it when the class is modified.
Remediation
Prevent default generation of the destructor and copy constructor:
- Provide your own version
- Or declare it private without implementing it to prevent the operation (for copy constructor)
Reference
"C++ Notes: OOP: Copy Constructors":http://www.fredosaurus.com/notes-cpp/oop-condestructors/copyconstructors.html
Related Technologies
C++
Technical Criterion
CWE-1098 - Data Element containing Pointer Item without Proper Copy Control Element
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.