Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Stallman Cranks Dat Soulja Boy!

Name: Anonymous 2008-06-22 6:23

Name: Anonymous 2009-01-08 13:55

>>158

//original function
results getTreasure(map room, char * treasureName, coord treasureLoc)
{
  checkRoom(room);
  //50 other statements go here
  if (returnItem (room, treasureLoc) == treasureName)
    return congratulations(treasureName);
  else
    failure();
}

//a different function but keeps the same interface
results getTreasure(map room, char * treasureName, coord treasureLoc)
{
   path Path;
   enterRoom (room);
   path = calculatePath (treasureLoc);
   if (path)
     moveChar(path);
     treasure = openTreasure();
     if (treasure.name == treasureName)
       return congratulations(treasureName);
   else
     return failure();
  
}

They both achieve the same goal but use a different means to achieve it. The interface to these functions (entry points and return points to the function) remain constant. The modified function implements it's own functions and does not call on any derived code. You can change the functionality of a program without deriving from the original.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List