title: What happens if i don't free/delete dynamically allocated arrays?
body: <p>This code is not written bt me!
  In the class WebServer we overload +=operator. The class uses dynamically allocated array of objects of type WebPage(another class, composition) defined as WebPage *wp;</p>
  
  <pre><code>WebServer &amp; operator +=( WebPage webPage ) {
  WebPage * tmp = new WebPage [ count + 1];
  for (int i = 0; i &lt; count ; i ++)
  tmp [i] = wp[i];
  tmp [ count ++] = webPage ;
  delete [] wp;
  wp = tmp;
  return * this ;
  }
  </code></pre>
  
  <p>So we create a new array of dynamically allocated WebPages with extra space for one object, then we assign them the values that wp held, and then the object that we wanted to add to the array. So if i remove <code>delete[] wp;</code> the program still works ok. So what happens if i remove that line of code? And also wp=tmp, what does that mean, is wp only a new name for that dynamically so it would suit the name in the class, but the location in memory is still the same? Or?</p>