There are several ways to fix this bug. The most direct is to replace
the statement
with
, and to add the statement
in the
class destructor.
A more meaningful bugfix would involve recognizing that the semantics of the class is wrong. Set/get pairs should behave with the same data, and the fact that the integer data within the class (theInt) has a name which does not remind of a pointer are strong hints that the real bug was to design a class that stores an integer pointer when all that was needed was simply an integer. Thus the ``correct correction'' is to make all changes so that theInt is an integer variable instead of a pointer to integer.
Leo Liberti 2008-01-12