title: Deleting specific class objects stored in an array
body: <p>I have a problem with my code and I was wondering if someone could have a look, I have a function I have created to delete a specific element from an array. I use a linear search to find the element then I overwrite the element I want to get rid of with the one after as I have not found a way to delete an element specifically. my problem is that the code does not really work as the element does not get overwritten, also is there a way to leave an blank space in the array once the element has been overwritten.</p>
  
  <p>below is my code: </p>
  
  <pre><code>void deleteinfo()
  {
      string search ;
      int found ;
  
      cout &lt;&lt; "\n Delete A Player's Information \n\n" ;
      cout &lt;&lt; "Please Enter The Player's Last Name : " ;
      cin &gt;&gt; search ;
  
      found=linsearch(search);
  
      if (found==-1)
      {
          cout &lt;&lt; "\n There is no player called " &lt;&lt; search ;
      }
      else
      {
          player[found].getFirstName() = player[found + 1].getFirstName() ;
          player[found].getLastName() = player[found + 1].getLastName() ;
          player[found].getAge() == player[found + 1].getAge() ;
          player[found].getCurrentTeam() = player[found + 1].getCurrentTeam() ;
          player[found].getPosition() = player[found + 1].getPosition() ;
          player[found].getStatus() = player[found + 1 ].getStatus() ;
  
          cout &lt;&lt; "\n Player has been deleted." ;
      }
  
      cin.get() ;
  
      menu() ;
  }
  
  
  int linsearch(string val)
  {
      for (int j=0; j &lt;= 3; j++)
      {
          if  (player[j].getLastName()==val)
           return j ;         
      }
          return -1 ;
  }
  </code></pre>