Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!know!news.cs.indiana.edu!nstn.ns.ca!clyde.concordia.ca!antares.concordia.ca!marcap From: marcap@antares.concordia.ca ( MARC ANDREW PAWLOWSKY ) Newsgroups: comp.lang.c++ Subject: Re: Want pointers on intelligent pointers Message-ID: <861@antares.Concordia.CA> Date: 20 Mar 91 00:47:16 GMT References: <669258004.1@mmug.edgar.mn.org> Sender: news@Antares.Concordia.CA Organization: Concordia University, Montreal Quebec Lines: 44 Nntp-Posting-Host: antares.concordia.ca In article <669258004.1@mmug.edgar.mn.org> Jim.Spencer@p510.f22.n282.z1.edgar.mn.org (Jim Spencer) writes: in response to my call for help > >Novice curiosity here. Why do you want your deletion routine to be > the destructor? Presumably you are calling the destructor yourself, > at least indirectly with delete. If so, instead of calling delete, > call another member function, say check_delete(). > This in turn could call the destructor couldn't it? > The idea I was thinking was something like: A *A::a(void) { ... create a new instance of A and return it. } A::b(void) { A a = a(); put a into some global data structure such as a linked list. } The linked list would be in use, and it is necessary to keep track how many times the objects are being used. While I can call a function other than delete, I thought it would be nice to use destructor oeprator since other people will be using my classes, so if somebody did C::c(void) { A a; ... all sorts of nifty things } "a" would be deleted properly, even though no explicit destuction routine is called.