On Thu, 21 Jan 1999, Joseph Keen wrote:

> In C++ you must always specifically call the destructor before the
> variable goes out of scope.  When it goes out of scope the variable name
> and the memory it points to become unlinked and there is no way for you to
> go back and free that memory.  That's how you get memory leaks :)

The destructor of an object is automatically called when the object goes
out of scope. There's no need to "specifically call the destructor" (which
I think you mean 'explicitly').

> >     class Foo
> >     {
> >       Foo()
> >         { word = new char[LENGTH + 1];  }
> > 
> >       ~Foo()
> >         { delete word; }

delete[] word;

- Herry

Reply via email to