Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!borland.com!pete From: pete@borland.com (Pete Becker) Newsgroups: comp.lang.c++ Subject: Re: Pure virtual destructors are illegal? Keywords: virtual destructor Message-ID: <1991Jun4.223627.29139@borland.com> Date: 4 Jun 91 22:36:27 GMT References: <183@swampthing.sbi.com> <1991Jun1.192610.18321@borland.com> <185@swampthing.sbi.com> Organization: Borland International Lines: 22 In article <185@swampthing.sbi.com> wfl@swampthing.sbi.com (W. Linke CPE) writes: >> "Pure virtual" does not mean "no implementation"! It only means that >> a derived class must override the pure virtual function. In the case of a >> pure virtual destructor, since it will be called by the destructor for the >> derived class, you must provide an implementation. > >A pure virtual member function *MAY* be defined for the abstract class in which >it is declared, but it *MUST* be overridden in some class derived from the >abstract class in order to create class objects, > >but a pure virtual destructor *MUST* be defined for the abstract class in which >it is declared, while it *MAY* be "overridden" in classes derived from the >abstract class. Well, there really is an underlying consistency. Every pure virtual function must be overridden in a derived class, whether it's a destructor or not. The reason you also have to define a pure virtual destructor is that the pure virtual declaration IS a declaration, and tells the compiler not to provide one for you. I agree that this is somewhat less than obvious.