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
- C++ Destructor Question holotko
- Re: C++ Destructor Question Suresh
- RE: C++ Destructor Question Michael Traffanstead
- Re: C++ Destructor Question Joseph Keen
- Re: C++ Destructor Question Jakob Andreas Baerentzen
- Re: C++ Destructor Question Herry Budiutama
- Re: C++ Destructor Question Zygo Blaxell
- Re: C++ Destructor Question Adam Wiggins
- Re: C++ Destructor Question Mike Brownlow
- Re: C++ Destructor Question holotko
- Re: C++ Destructor Question Bryan Scaringe
- Re: C++ Destructor Question Prasanna Bose
- Re: C++ Destructor Question holotko
- RE: C++ Destructor Question John Weldon
- Re: C++ Destructor Question Prasanna Bose
- Re: C++ Destructor Question Peter Schuller
