On 2002-06-06, Nadav Har'El wrote:
> On Thu, Jun 06, 2002, Shlomi Fish wrote about "Some C++ Questions":
> > 2. I want to destroy a dynamically allocated object without knowing its
> > exact class in advance. I can declare a virtual destroy method that will
> > call (delete this;), but I'll have to do it for each inheritance level. Is
> > there a better way.
> 
> Look up "virtual destructor" in your favorite C++ book.
> 
> And never do something like "delete this"!

I guess "never" is not the correct word.
There *are* legitimate uses of "delete this",
For example in the RCProxy design pattern.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to