Listing 3

/* Debugging Objects with Turbo Debugger

add the following line to the public part of the
                   Queen class declaration:
                   
   void eatFood( int nUnits );
   
(i.e., the line before the closing brace
                 of the declaration!)
*/
// Add the following function definition to the
                         file ANTHILL.CPP:


void Queen::eatFood( int nUnits )
{
if (nEnergy < 20000)
   Consumer::eatFood( nUnits );
else {
   int oldX = nX;
   int oldY = nY;
   move();
   showFood( oldX, oldY, TRUE );
   }
}
// end of file