Loren Pechtel wrote:
> > But that is not what is going on here anyway. The destructor is > > freeing INTERNAL private fields, to which only the code of the > > instance has access. Since we are already in the destructor, the > > only code that CAN access these fields are the few lines that > > follow, and I expect any half intelligent programmer to be able to > > prevent those from accessing a field that was freed a few lines > > ago. After that, nothing can access them anymore. > > Nope. They're still accessible. > > Remember that objects themselves are really just pointers and remain > accessible even though they have been freed.
Well, your design will, of course, have to prevent that too. That means that there is only one reference (except for local copies of the reference, which disappear when the routine ends), and that is not freed before it can be freed, i.e. not as long as it is accessible. Follow that maxim and you can't access freed objects. -- Rudy Velthuis (TeamB) http://www.teamb.com
"Don't join the book burners." -- Dwight D. Eisenhower