Re: Questions on latest homework answers


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by Daniel Longet on April 06, 2001 at 01:21:52:

In Reply to: Re: Questions on latest homework answers posted by M. Heffner on April 06, 2001 at 01:03:50:

One purpose of the init list *is* to construct the subobjects. It is not the only purpose, nor do you need to manually invoke the constructors but it is still a purpose of it.

Daniel

: : Stroustrup in Section 10.4.6 says "The members' constructors are called before the body of the containing class' own constructor is executed." To me this says that you can use the initialization list to initialize the subobjects before the body of the constructor is executed (or the object is constructed the rest of the way).

: Then you're misinterpreting what Stroustrup is trying to say. You can
: use the the member initializer list to call a specific constructor of
: a sub-object or you can explicitly call the default constructor. Or
: (as illustrated with the second example under $10.4.6) instead of
: explicitly calling the default constructor, you can omit the member
: from the initializer list and the default constructor will be called
: automatically. In any case, ALL the sub-objects are ALWAYS constructed
: before the start of the constructor body of the outer class.

: Anyways, enough of this discussion on this board, followup by email if
: needed.




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]