Content deleted Content added
Christoofar (talk | contribs) No edit summary |
Christoofar (talk | contribs) No edit summary |
||
Line 7:
In C++ in particular, the original class programmer may have only placed the object cleanup code within the object's destructor prior to architecting the class so that it can be used within a pool. In that situation, the class deconstructor is only called when the object is torn down by the pool manager, and clients continue to recieve object instances which have unpredictable state.
For example, consider a programmer who writes a CreditCardPool class which
As the program runs on this "dirty" instance, the card authorization declines. However, when the ApprovalCode field is checked, it has a value that shows the card was approved, but this was an approval code for someone else's account... not the current instance's.
|