This Fraction class can encounter integer overflow if the cross product of numerators or denominators exceeds 2^63. You can avoid most such problems in full versions of this class by prescaling.(Cases of potential integer overflow problems in other code examples in the book are somehow mentioned in accompanying text, but this one got by without a disclaimer.)
However, subsequent withdrawals may be penalized by such a missed update. To avoid the possibility of continually blocking out these savings-initiated transfers, they could use a time-based retry operating on a fair synchronization tool such as a FIFOSemaphore rather than use the illustrated exit without transfer when busy in method tryTransfer.
Thanks to Christopher Smith, Attila-Mihaly Balazs, and AG McDowell for pointing out problems.
Please send any questions or comments about this book to dl@cs.oswego.edu
.