title: Pop "Debug Assertion Failed"
body: <p>I don't know what's wrong, Do I need define a constructor or just keep a copy constructor?  I think It's a issue about shallow and deep copies.  Please help, Thank you.
  <a href="https://i.stack.imgur.com/s9Knb.png" rel="nofollow noreferrer">When I was debugging, Pop this window</a></p>
  
  <pre><code>#include &lt;cstring&gt; 
  #include&lt;iostream&gt; 
  using namespace std;
  
  class MyString
  {
  public:
      MyString(const char* s);  //constructor
      ~MyString() {  //destructor
          delete[]data; 
      }
  protected:
      unsigned len;
      char* data;
      //char data[20];
  };
  
  MyString::MyString(const char* s)
  {
      len = strlen(s);
      data = new char[len + 1];
      strcpy_s(data, len, s);
  }
  
  int main()
  {
      MyString a("C++ Programming");
      MyString b(a);
      return 0;
  }
  </code></pre>