www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/17/21:01:49

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Deconstructors
Date: Fri, 17 Jul 1998 17:43:05 -0700
Organization: Alcyone Systems
Lines: 22
Message-ID: <35AFEF99.29955266@alcyone.com>
References: <35AFE02F DOT 3C4857ED AT logic-gate DOT com>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Michael Tanczos wrote:

> When are deconstructors called when using classes?  At the
> end of the program if it's declared statically.. or when
> you delete the object if it's declared dynamically?  Or do
> you need to call the deconstructor directly..

Automatic (local) objects are deconstructed when they go out of scope. 
(When you leave the block to which they belong.)  Dynamic objects
(allocated with new) are deconstructed when you use the operator delete
on them.

You should not be attempting to explicitly call a destructor unless you
are doing something very, very strange.

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm:+37.20.07/-121.53.38
                                     \
           I put away my nine, fool / 'cause I'm colorblind.
                                   / Ice Cube

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019