Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcnc!decwrl!bacchus.pa.dec.com!hollie.rdg.dec.com!decvax.dec.com!zinn!nuucp From: mjv@objects.mv.com (Michael J. Vilot) Newsgroups: comp.lang.c++ Subject: Re: Deleting derived classes Message-ID: <1000@zinn.MV.COM> Date: 10 Nov 90 04:10:52 GMT Sender: nuucp@zinn.MV.COM Lines: 24 Matthew Donaldson asks: > if a delete function > is declared in the derived class, it will be used, and the one defined in > the base class will be ignored. Is this part of the language definition, > or a bug in the compiler? This is part of the language definition. Class-specific operators new and delete are static, and inherited. See Sections 5.3.3 and 12.5 of ``The Annotated C++ Reference Manual.'' > ... [example] .. > I assume that the virtual > table has been corrupted somehow. Does it get dismantled before the delete > function of the base class gets control? Is it possible to stop a deletion > of a derived class like this? Not corrupted, but changed. The base class destructor is using the virtual table of the base class, not the derived class. See Section 12.7 of the ARM. Hope this helps, -- Mike Vilot, ObjectWare Inc, Nashua NH mjv@objects.mv.com (UUCP: ...!decvax!zinn!objects!mjv)