Article View: comp.std.c++
Article #2535Re: Virtual functions and destructors
From: Harald Fuchs
Date: Mon, 13 Nov 1995 13:08
Date: Mon, 13 Nov 1995 13:08
21 lines
1911 bytes
1911 bytes
herbs@interlog.com (Herb Sutter) writes:
> However, it might help Chris if we answered a related question using
> inheritance in the proper direction (down!):
> struct Base1 { virtual ~Base1() {}; }
> struct Base2 { ~Base2() {}; }
> struct Derived : public Base1, public Base2 { ... };
> This question is, Is Derived::~Derived() virtual, since one of the bases has
> a virtual dtor and one doesn't? This answer is, Yes: 'once virtual, always
> virtual' (in derived classes), just like with any virtual member function.
~Derived is virtual with respect to Base1, but AFAIK not with respect
to Base2. If you delete a Derived* through a Base2*, all compilers I
know only call ~Base2 ().
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<pulopk4x5p.fsf@themroc.colibri.de>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<47r71q$cp0@bigboote.WPI.EDU> <9531520.16333@mulga.cs.mu.OZ.AU> <48541k$58r@steel.interlog.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 13 Nov 95 13:08:03 GMT Approved: fjh@cs.mu.oz.au From: hf@colibri.de (Harald Fuchs) Newsgroups: comp.std.c++ Subject: Re: Virtual functions and destructors X-Original-Date: 13 Nov 1995 11:38:26 +0100 Organization: Colibri GmbH, Germany Message-ID: <pulopk4x5p.fsf@themroc.colibri.de> References: <47r71q$cp0@bigboote.WPI.EDU> <9531520.16333@mulga.cs.mu.OZ.AU> <48541k$58r@steel.interlog.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit In-Reply-To: herbs@interlog.com's message of 13 Nov 95 06:50:56 GMT X-Www-Home-Page: http://www.colibri.de/~hf/ X-Pgp-Public-Key: finger hf@colibri.de X-Pgp-Fingerprint: 09 4E C4 A2 B2 C5 33 1A 79 80 5D 39 BD 9B 89 39 X-Disclaimer: Kore wa Colibri no iken dewa arimasen X-Newsreader: Gnus v5.0.9 X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMKdDSuEDnX0m9pzZAQE9lgGAoRl9tAUHd9R+QA/GZwDBzmyGjA6W0HGC cdUxCJp/Z9VzEAKqru0UJ/4M0S0k4r04 =JH27