Re: Questions on latest homework answers

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

Posted by William D McQuain on April 05, 2001 at 08:21:55:

In Reply to: Questions on latest homework answers posted by M. Heffner on April 04, 2001 at 17:58:03:

: I have a couple questions on the latest home work assignment on
: inheritance.

: 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.

So? Answer #3 does not say the initializer list allows a change in construction order. The initializer list may be used to specify non-default behavior during the construction of sub-objects, or even redundantly to specify default behavior. Either way, the initializer list is being used to effect the construction of sub-objects. That's all answer #3 says; it doesn't even say that using the initializer list is the ONLY way to construct sub-objects, which seems to be how you're interpreting it.

: 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.

Why? The question does not say that. The question says to consider ALL access protections. That would include the "super-private" access protection for inherited private members.

Again, you're interpreting the question as if it said something it simply does not. For your interpretation the question would have to say something like: "how many accessible data members does an object of type Y have".

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 ]