home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: Self Deletion
- Message-ID: <By1Hwt.22p@cs.uiuc.edu>
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <1992Nov20.221751.2482@crd.ge.com>
- Distribution: usa
- Date: Sat, 21 Nov 1992 00:12:29 GMT
- Lines: 20
-
- In <1992Nov20.221751.2482@crd.ge.com> jim@galifrey (Jim Weirich) writes:
-
- >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".
-
- *****> Self-deletion is (will-be) a no-no; static members are another
- work-around.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-