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 :)
> i.e.
>
> class Foo
> {
> Foo()
> { word = new char[LENGTH + 1]; }
>
> ~Foo()
> { delete word; }
>
> ...
> }
>
> When I create an object of class Foo memory will be allocated for the
> char buffer "word". Now when the object is no longer needed must I
> make an explicit call to the destructor ~Foo() to destroy the object
> and subsequently call "delete", or, is the destructor somehow called
> automatically when the object is no longer needed,i.e. outside of
> it's scope?