[haiku-development] Re: destructor and virtual functions

Hi,

On 2008-03-07 at 22:30:45 [+0100], Rene Gollent <anevilyak@xxxxxxxxx> wrote:
> On Fri, Mar 7, 2008 at 3:24 PM, Stephan Assmus <superstippi@xxxxxx> wrote:
> > What happens if I call a virtual function from within the destructor of a
> >  base class? Will I always get the base class version of the function?
> >
> 
> Nope, you'd have to explicitly say baseclassname::function() if you
> want the base version to my awareness.

I have not checked with the standard, but I'd assume that from a destructor 
you can only reach methods from that class "upwards", as all the subclasses 
are already destroyed (their destructors were already executed). 
So I'd think that calling a method from a base class' destructor should 
invoke the implementation in that base class, not in any subclass of it. Just 
as it in the constructor, I suppose.

cheers,
    Oliver

Other related posts: