title: How to delete class as this and set it as null in c++
body: <p>So, I have an array of a class called "<code>Customer</code>"</p>
  
  <pre><code>Customer** customersarray[] = new Customer*[customer];
  </code></pre>
  
  <p>I'm receiving int customer with <code>cin</code>. </p>
  
  <p>anyways, in <em>customer.cpp</em>, there is a method called <code>void deactivate()</code>.</p>
  
  <p>which goes like this:</p>
  
  <pre><code>void Custmoer::deactivate() 
  {
      if (this != NULL)
          remove this;
      //this = NULL; I want to do this but it doesn't work.
  }
  </code></pre>
  
  <p>and the purpose of this is to remove it from customer array when satisfies a certain condition. So for example,</p>
  
  <pre><code>for (int i = customer - 1; i &gt;= 0; i--) 
  {
      if (customersarray[i]-&gt;getAngerLevel() == 5) {
          customersarray[i]-&gt;deactivate();
      }
  
      for (int z = i; i &lt; customer - 1; i++) {
          *(customersarray + z) = *(customersarray + z + 1);
      }
      customer--;
  }
  </code></pre>
  
  <p>so my first questions are:</p>
  
  <ol>
  <li><p>why does <code>this = NULL</code> not work?</p></li>
  <li><p>is there a simpler way to remove something from pointer array when a condition is satisfied? (for example, remove all customers that has anger level of 5.)</p></li>
  </ol>