title: Deleting array in destructor of the class
body: <p>I have class NameClass with members:</p>
  
  <pre><code>class NameClass {
      public:
  
      int count;
      apple* array;
  } 
  </code></pre>
  
  <p>and constructor of this:</p>
  
  <pre><code>NameClass::NameClass()
  {
      count = 12;
      array = new apple[count];
      ...
  }
  </code></pre>
  
  <p>Should I delete this array in destructor of class? And how? </p>
  
  <p>This makes the error (<em>"pointer being freed was not allocated"</em>):</p>
  
  <pre><code>delete []apple;
  or 
  delete apple;
  </code></pre>