home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18783 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.2 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!spool.mu.edu!umn.edu!pico.cs.umn.edu!hansen
  3. From: hansen@pico.cs.umn.edu (David Hansen)
  4. Subject: Re: How to prevent local instances, but allow "new"
  5. Message-ID: <1993Jan7.014434.28955@news2.cis.umn.edu>
  6. Sender: news@news2.cis.umn.edu (Usenet News Administration)
  7. Nntp-Posting-Host: pico.cs.umn.edu
  8. Organization: University of Minnesota
  9. References: <1icij0INNdhc@news.cerf.net> <726348154snx@trmphrst.demon.co.uk>
  10. Date: Thu, 7 Jan 1993 01:44:34 GMT
  11. Lines: 19
  12.  
  13. In article <726348154snx@trmphrst.demon.co.uk>, nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
  14. [...]
  15. |> 
  16. |> Leave the constructors public. Make the DESTRUCTOR private. Provide an
  17. |> inline member function ... 
  18. |> 
  19. |>     void destroy() { delete this; }
  20. |> 
  21. |> Users have to call destroy instead of delete, but they won't be able to
  22. |> create automatic, static or extern objects of the class.
  23.  
  24. This is the approach I took.  However...
  25.  
  26. When I first started reading this group, there was a discussion about whether 
  27. "delete this" would be legal in the future.  The general consensus (from what
  28. I read) was "probably not."  Is there still a question about this?  The above
  29. seems to me a good argument for keeping it legal.
  30.  
  31.                     -=Dave
  32.