"Buster" <noone@nowhere.com> wrote in message
news:c1agsm$mqq$1@newsg2.svr.pol.co.uk...[color=blue]
>
> "Rajat Chadda" <rajat.chadda@wipro.com> wrote[color=green]
> > Given a pointer within an object, C++ runtime could have been[/color]
> written[color=green]
> > to delete the pointed object automatically. Why is it that they
> > require a destructor to be written instead?[/color]
>
> Not all pointers point to dynamically created objects. Not all
> dynamically created objects are created with new. Not all objects
> containing pointers (even pointers to dynamically created objects)
> own the pointed-to object. That's just off the top of my head.
>
> Hope that helps,
> Buster.
>
>[/color]
Good list. I will also add that destructors don't necessarily have anything
to do with deleting pointers. They can free other resources (e.g. files) or
do other kinds of cleanup activities which have nothing to do with releasing
resources.
--
Cy
http://home.rochester.rr.com/cyhome/