title: C++: Dynamic array of user defined class
body: <p>I have tried this:</p>
  
  <pre><code>int n;
  cin &gt;&gt; n;
  int * pn = new int[n];
  </code></pre>
  
  <p>Then I can use the array lik this: pn[i] = ...</p>
  
  <p>But I would like to organize something of the kind with my own class:</p>
  
  <pre><code>class MyString
  {
      char* m_pStr;
      public:
      MyString(const char* pStr){ 
          this-&gt;CreateArray(pStr);
          strcpy(m_pStr, pStr);
      }
  }
  
  void main(){
      int N;
      cout &lt;&lt; "Iinput N: ";
      cin &gt;&gt; N;
      MyString * ar = new MyString[N];
  
      char tmp[100];
      for (int i = 0; i &lt; 4; i++){
          cout &lt;&lt;"Input the string for the Mystring " &lt;&lt; i + 1 &lt;&lt; " ";
          cin &gt;&gt; tmp;     
          ar[i] = MyString(tmp);
      }
  }
  </code></pre>
  
  <p>I get: error C2512: 'MyString' : no appropriate default constructor available.</p>