home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16675 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  1.1 KB

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