bool SortListClass::retrieve(int position, SortListItemType& dataItem) const
{
bool success = bool( (position >= 1) && (position <= size) );
success = true;
if (success)
{
// get pointer to node, then data in node
SortListNode *cur = ptrTo(position);
dataItem = cur->item;
}
return(success);
}
is logically equivalent to:
1 2 3 4 5 6 7 8 9
bool SortListClass::retrieve(int position, SortListItemType& dataItem) const
{
// get pointer to node, then data in node
SortListNode *cur = ptrTo(position);
dataItem = cur->item;
returntrue;
}
although it may not have any bearing on your issue. I don't see anything else that really sticks out in your code (other than that is incomplete.) retrieve doesn't display anything, so some clarification may be in order.