delorie.com/archives/browse.cgi | search |
X-pop3-spooler: | POP3MAIL 2.1.0 b 4 980420 -bs- |
Message-ID: | <19980812161504.A23422@amdiv.de> |
Date: | Wed, 12 Aug 1998 16:15:04 +0200 |
From: | Felix von Leitner <leitner AT amdiv DOT de> |
To: | Pentium GCC <pgcc-list AT Desk DOT nl> |
Subject: | Is this a bug? |
Mail-Followup-To: | Pentium GCC <pgcc-list AT Desk DOT nl> |
Mime-Version: | 1.0 |
X-Mailer: | Mutt 0.94.1i |
Sender: | Marc Lehmann <pcg AT goof DOT com> |
Status: | RO |
Lines: | 36 |
If I execute this code, to my understanding foo::bug should never be called, since it is a virtual function. Felix #include <stdio.h> class foo { public: foo() { } virtual void bug() { puts("why am I being called?"); } ~foo() { puts("start of foo::~foo"); bug(); } }; class bar : public foo { public: bar() : foo() { } virtual void bug() { puts("bug not there"); } ~bar() { bug(); // should not be calling bar::bug puts("end of bar::~bar"); } }; main() { class bar temp; }
webmaster | delorie software privacy |
Copyright � 2019 by DJ Delorie | Updated Jul 2019 |