Article View: alt.comp.lang.learn.c-c++
Article #115Re: Base - derived problem.
From: Colin Park
Date: Wed, 18 Aug 1999 00:00
Date: Wed, 18 Aug 1999 00:00
10 lines
1616 bytes
1616 bytes
I concur with Mr. Colston. When a new is called, there is eventually a call to the constructor. (See More Effective C++, by Scott Myers, page 40) The Base class ctor is always called first, so the derived parts don't exist yet. The problem might go away if the call were in the ctor for the derived class. Presumably this call is part of object initialization. You could call the derived class version of the virtual function from the derived class ctor. The derived class version could call the base class version with the scope resolution operator.
Technical Details
Message-ID:
<37BB4F9F.61EC@ameritech.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<wQUm3.8699$D4.125836@news.tpnet.pl> <7ni1cd$c8s$1@news.socomm.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fe105,4a24208a4bcf639b X-Google-Attributes: gidfe105,public X-Google-Thread: 10d4ba,4a24208a4bcf639b X-Google-Attributes: gid10d4ba,public X-Google-Thread: 108b44,4a24208a4bcf639b X-Google-Attributes: gid108b44,public X-Google-Thread: 114592,4a24208a4bcf639b X-Google-Attributes: gid114592,public From: Colin Park <crolma@ameritech.net> Subject: Re: Base - derived problem. Date: 1999/08/18 Message-ID: <37BB4F9F.61EC@ameritech.net> X-Deja-AN: 514375273 Content-Transfer-Encoding: 7bit References: <wQUm3.8699$D4.125836@news.tpnet.pl> <7ni1cd$c8s$1@news.socomm.net> Content-Type: text/plain; charset=us-ascii X-Trace: nntp0.detroit.mi.ameritech.net 935011839 199.179.175.236 (Wed, 18 Aug 1999 17:30:39 EDT) Organization: Ameritech.Net www.ameritech.net Complaints: abuse@ameritech.net MIME-Version: 1.0 Reply-To: crolma@ameritech.net NNTP-Posting-Date: Wed, 18 Aug 1999 17:30:39 EDT Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.sys.lang.c++,pl.comp.programming