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"!

-- 
Nadav Har'El                        |      Thursday, Jun 6 2002, 26 Sivan 5762
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |A city is a large community where people
http://nadav.harel.org.il           |are lonesome together.

=================================================================
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