title: Can an object destroy itself?
body: <p>I have an object which needs to destroy itself. </p>
  
  <ul>
  <li><p>Can it be done?</p></li>
  <li><p>Is the example wrong?</p>
  
  <pre><code>void Pawn::specialMoves(Coordinate const&amp; from, Coordinate const&amp; to, int passant)
  {
     /*...*/
      m_board-&gt;replace(to, new Queen(m_colour));//replace pawn by queen
  }
  
  void Board::replace(Coordinate const &amp;to, Piece* newPiece)
  {
      delete tile[to.x()][to.y()];
      tile[to.x()][to.y()] = newPiece;
  }
  </code></pre></li>
  </ul>