Article View: gnu.g++.bug
Article #1047Re: Bug in g++? (NOT!)
From: Joe Buck
Date: Sat, 10 Oct 1992 21:53
Date: Sat, 10 Oct 1992 21:53
18 lines
1411 bytes
1411 bytes
In article <FREDR.92Oct9171859@mynah.bu.edu> fredr@raven.bu.edu (Fred Richardson) writes: >I think I've found a bug which occurs when virtual functions are >overriden and called by the construction routine. It looks like if a >virtual function is over riden by a derived class and it is called in the >base classes constructor then only the base classes implementation of the >virtual function will be called. But this only happens in the base classes >constructor routine. This is standard behavior. If you have another compiler that does something different, that other compiler is broken. The reason that derived class functions are not executed from the base constructor is that none of the derived class's fields have been initialized yet; conceptually, the object is still a Base, not a Derived. Similarly, in the baseclass destructor, the object is treated as if it belonged to the derived class and not the base class. -- Joe Buck jbuck@ohm.berkeley.edu
Technical Details
Message-ID:
<1b7jdeINNgp7@agate.berkeley.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!forney.berkeley.edu!jbuckReferences:
<FREDR.92Oct9171859@mynah.bu.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!forney.berkeley.edu!jbuck From: jbuck@forney.berkeley.edu (Joe Buck) Subject: Re: Bug in g++? (NOT!) Message-ID: <1b7jdeINNgp7@agate.berkeley.edu> Sender: gnulists@ai.mit.edu Organization: U. C. Berkeley References: <FREDR.92Oct9171859@mynah.bu.edu> Distribution: gnu Date: Sat, 10 Oct 1992 21:53:50 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 19