Thread View: comp.std.c++
3 messages
3 total messages
Started by john (j.d.) hickin
Thu, 09 Nov 1995 19:27
An Extra Virtual Destructor Question to Ponder
Author: john (j.d.) hickin
Date: Thu, 09 Nov 1995 19:27
Date: Thu, 09 Nov 1995 19:27
18 lines
965 bytes
965 bytes
Now that the standard has carefully specified what virtual functions run when
called from constructors/destructors in objects with multiple inheritance it
becomes possible to allow the following:
class X { public: X(); virtual ~X() = 0; };
Has this been considered?
--
John Hickin Bell-Northern Research, Montreal, Quebec
(514) 765-7924 hickin@bnr.ca
---
[ 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. ]
Re: An Extra Virtual Destructor Question to Ponder
Author: J. Kanze
Date: Fri, 10 Nov 1995 19:17
Date: Fri, 10 Nov 1995 19:17
28 lines
1592 bytes
1592 bytes
john (j.d.) hickin (hickin@bnr.ca) wrote:
|> Now that the standard has carefully specified what virtual functions run when
|> called from constructors/destructors in objects with multiple inheritance it
|> becomes possible to allow the following:
|> class X { public: X(); virtual ~X() = 0; };
|> Has this been considered?
In what way? This has always been legal, and I see nothing in the
present draft to change it. I occasionally use the idiom to force a
class to be abstract even when I want to provide default behavior for
all of the member functions.
Of course, you do still have to provide an implementation of the
destructor somewhere.
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
---
[ 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. ]
Re: An Extra Virtual Destructor Question to Ponder
Author: Wim Veldhuis
Date: Wed, 28 Feb 1996 18:18
Date: Wed, 28 Feb 1996 18:18
33 lines
2290 bytes
2290 bytes
In message <47voa1$969@gabi.gabi-soft.fr> - kanze@gabi-soft.fr (J. Kanze)
writes:
:>
:>
:>john (j.d.) hickin (hickin@bnr.ca) wrote:
:>
:>|> class X { public: X(); virtual ~X() = 0; };
:>
:>|> Has this been considered?
:>
:>In what way? This has always been legal, and I see nothing in the
:>present draft to change it. I occasionally use the idiom to force a
:>class to be abstract even when I want to provide default behavior for
:>all of the member functions.
Yes, but there is a difference between a normal member function and a dtor.
The normal memberfunction has to be called explicitly before it is invoked.
If the function is overridden, it is not called unless you explicitly call it
from the overridden version. Doing this will generate an error since their
actually is no implementation for the function called. With dtors, this is
different as all inherited dtors are automatically called when an object is
destructed. What you are saying here is that there is somewhere in the draft
a rule which states that if a dtor is declared pure virtual, a default
implementation (or none at all) is automatically created. Is this the case ?
Wim Veldhuis,
veldhuis@xs4all.nl
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads