Are you sure your destructor is declared virual in CSomeClass

 -----Original Message-----
From:   Brian Hall [mailto:[EMAIL PROTECTED]]
Sent:   Thursday, September 23, 1999 12:56
To:     [EMAIL PROTECTED]
Subject:        Re: destructors

>> 2)Destructors don't seem to work at all.
>
>I think you may have some options turned off in the compiler or so: I use
>both of these features and they work quite well.

FWIW, I had problems getting destructors to be called as well. The problem
is that if you create a subclass, but then call delete when the type is the
superclass, the base class destructor gets called, not the destructor of
the actual object.

ie
   CSomeClass *anObject;

   anObject = new CSubClass
   delete anObject           // calls CSomeClass delete, not CSubClass
delete

This is bad if you make a base class (say CChore), and then want to delete
a derived instance (say CDoSomethingChore) in a generic way.

Brian


_____________________________________________________________________
Mark/Space Softworks                               voice 408-293-7299
111 West Saint John, 3rd Floor                       fax 408-293-7298
San Jose, CA 95113                         <http://www.markspace.com>

    Mac OS, PalmOS, Windows, Web and Newton Software & Solutions:
        PageNOW!, PageME!, PhoneWatcher, Online, Communicate,
            ZMODEM, Telnet, PC-ANSI, Videotex CTB Tools

Reply via email to