Re: C++ design question
From: Universe (universe_at_tAkEcovad.OuT.net)
Date: 09/29/04
- Next message: Mike Smith: "Re: Why Software Is Bad and What We Can Do to Fix It"
- Previous message: Universe: "Re: XP Requirement Analysis?"
- In reply to: Simon Elliott: "Re: C++ design question"
- Next in thread: H. S. Lahman: "Re: C++ design question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Sep 2004 16:47:02 -0400
"Simon Elliott" <Simon at ctsn.co.uk> wrote:
> On 28/09/2004, Universe wrote:
> > > > barDerived(int i1, int i2):i2_(i2),barBase(i1){}
> >
> > > ^ Please explain the above line. ^
> > >
> > > Elliott
> >
> > The reason I ask is because as I understand doing:
> >
> > > > barDerived(int i1, int i2):i2_(i2),barBase(i1){}
> >
> > does not initialize the specific base class instance created as a part
> > of creating an instance of this derived class if that was the intent.
>
> Are you sure? My reading of the C++ standard (12.6.2) and tracing the
> flow of execution in the debugger seem to indicate otherwise.
>
> > 1) The derived classes ctor expressions do not initialize their base
> > class instance part if that is the intent. They initialize some base
> > class instance, but by the time one gets to initializing a base class
> > instance the base class instance that is part of the derived class is
> > *already* constructed and incorporated into the larger derived class
> > instance.
>
> As above, are you sure about this?
>
> > 2) It is definitely not recommended in C++ to attempt to initialize
> > the base class instance part of a derived class instance from a
> > derived class instance in the same statement that creates the derived
> > class instance.
> >
> > Off the top I would create a structure 'struct' external to both the
> > base and derived classes that holds the derived classes members that I
> > want their base classes to interact with.
>
> > See "Fragile Base Class' in Struvstrup's FAQ at his web site for more
> > particulars on the external structure solution.
>
> I can't find a reference to this anywhere on
> http://www.research.att.com/~bs/. Do you have any other pointers to
> this issue?
Trying, but keep at it also.
See his interviews at:
http://www.artima.com
also.
Mucho good constructor, virtual constructor and inheritance base class,
base class data member stuff in those. Also try those words as keys on
Google and or at the BS site.
G'luck,
Elliott
--
How can Bush be winning on terrorism when:
~ the war in Iraq diverts military and $$$
from Al Queda et al?
~ Iraq is NOW a tremendous hot bed of terrorism?
How can Bush be an expert at foreign affairs when:
~ he's bungling the war in Iraq as just judged BY
INTELLIGENCE EXPERTS?
~ he's alienated and worsened world US support?
- Next message: Mike Smith: "Re: Why Software Is Bad and What We Can Do to Fix It"
- Previous message: Universe: "Re: XP Requirement Analysis?"
- In reply to: Simon Elliott: "Re: C++ design question"
- Next in thread: H. S. Lahman: "Re: C++ design question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|