Questions on latest homework answers

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

Posted by M. Heffner on April 04, 2001 at 17:58:03:

I have a couple questions on the latest home work assignment on

First, on question number 19, I think the answer should be 2, rather
than 5 (2 + 3). Answer 3 states "to construct an object's sub-objects
before the rest of the object is constructed," however this is not
entirely correct. The sub-objects of a class are always implicilty
constructed prior to the rest of the object, the member initializer
list allows the programmer to explicitly call a specific constructor
of the sub-object. The member initializer list does NOT allow the
programmer to change the default construction order.

Second, on question number 16, yes it's obvious that class Y has two
elements (Y::f and X::m) however the addition of the part
"(considering all access protections)" implies that the question is
looking for how many elements class Y can directly access. If the
question was only asking for how many total elements class Y has, than
I can't see any reason for the additional statement to consider access
protections. This addition only made the question ambiguous, as seen
from another post on the discussion board concerning question #16.

Follow Ups:

Post a Followup




Optional Link URL:
Link Title:
Optional Image URL:

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