== Why is this an issue?

Any class that has memory to manage should provide all the methods necessary to properly manage that memory, including a copy constructor and an override of ``++operator=++``. Without those methods, you're likely to end up with memory leaks and multiple class instances pointing at the same segments of memory for their members.


=== Noncompliant code example

[source,cpp]
----
class MyClass // Noncompliant
{
  private:
    char* cpData;
  public
    MyClass(const char* value);
    ~MyClass();
}

MyClass a = new MyClass("The quick red fox");
MyClass b = new MyClass("How now brown cow");

b = a;  // cpData pointer, not value copied. Also b's old value not deleted: Memory leak.
----


== Resources


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

=== duplicates: S3624

endif::env-github,rspecator-view[]
