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