Good Object Oriented Design When Deleting, C++
<p>The code below deletes the symbol associated with the stock object just fine. Its just bad object oriented design. </p>

<p>The way that i am searching for each stock symbol is by using a != or == test for NULL.</p>

<pre><code>bool hashmap::remove(char const * const symbol, stock &amp;s,
int&amp; symbolHash, int&amp; hashIndex, int&amp; usedIndex)
{
    if ( isAdded == 0 ) return false;
    if ( hashTable[isRemoved].symbol == symbol ) return true; 
    else 
    {
     symbolHash = this-&gt;hashStr( symbol ); 
     hashIndex = symbolHash % maxSize;
     usedIndex = hashIndex;
    }
    for ( int integer = 0; integer &lt; maxSize; integer++ )
    {
     if ( hashTable[usedIndex].symbol != NULL &amp;&amp;
       strcmp( hashTable[usedIndex].symbol, symbol ) == 0 )
     { 
      isAdded--; 
      isRemoved = hashIndex; 
      s = &amp;hashTable[usedIndex];
      delete hashTable[usedIndex].symbol; 
      hashTable[usedIndex].symbol = NULL; 
      return true;
         }
     ++usedIndex %= maxSize; // wrap around if needed
    }
    return false;
}
</code></pre>

<p>Im wondering now, if i delete in a such a way that:</p>

<pre><code>hashTable[usedIndex].symbol = hashTable[NULL].symbol
</code></pre>

<p>Thereby, changing the way I logically test for an empty or found stock symbol. Is their a way to remove my stock symbol without having to redo the aspect of finding and searching?</p>

<p>Is this the correct way to remove in object oriented design?</p>
