home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!galifrey!jim
- From: jim@galifrey (Jim Weirich)
- Newsgroups: comp.lang.c++
- Subject: Self Deletion
- Message-ID: <1992Nov20.221751.2482@crd.ge.com>
- Date: 20 Nov 92 22:17:51 GMT
- Sender: usenet@crd.ge.com (Required for NNTP)
- Organization: GE Corporate R&D Center
- Lines: 15
- Nntp-Posting-Host: galifrey.ae.ge.com
- X-Newsreader: Tin 1.1 PL3
-
- I am writing a windowed application using C++. Each window is a C++
- object and interprets button presses and such through member
- functions. When the CLOSE button is pushed, I wish to delete the
- window. The most straight forward way is have the window object delete
- itself by saying "delete this;" inside the member function handling
- the CLOSE button. This seems to work, but I wonder if it is proper to
- delete an object while executing one of its member functions.
-
- Work arounds obviously are possible (e.g. mark the object for
- deletion, then have another object actually do the "delete" sometime
- later), but why complicate things if self deletion is "OK".
-
- Any Comments? ... (E-Mail or Post)
-
- -- Jim Weirich (jim@galifrey.ae.ge.com)
-