Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!cod!mball From: mball@cod.NOSC.MIL (Michael S. Ball) Newsgroups: comp.lang.c++ Subject: Re: destructors, derived classes, and pointers Message-ID: <1285@cod.NOSC.MIL> Date: 30 Oct 88 18:13:39 GMT Article-I.D.: cod.1285 References: <16219@agate.BERKELEY.EDU> Reply-To: mball@cod.nosc.mil.UUCP (Michael S. Ball) Organization: Naval Ocean Systems Center, San Diego Lines: 13 In article <16219@agate.BERKELEY.EDU> pete@violet.berkeley.edu (Pete Goodeve) writes: >The problem is that all the managing procedure has is a pointer to the >object (of the base type naturally). Now I would expect that a delete call >on this pointer would detect the correct destructor to invoke before it >actually disposed of the memory, but NOOO! It calls ONLY the parent type >destructor!!! So much for nice neat cleanup... > Make your destructor virtual and all will work as you wish...... Mike Ball TauMetric Corporation 1094 Cudahy Pl. Ste 302 San Diego, CA 92110 (619)275-6381