Re: Questions on latest homework answers

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

Posted by M. Heffner on April 05, 2001 at 11:12:08:

In Reply to: Re: Questions on latest homework answers posted by William D McQuain on April 05, 2001 at 08:21:55:

: : First, on question number 19, I think the answer should be 2, rather...

: So? Answer #3 does not say the initializer list allows a change in construction order.

The answer states that it's used to construct the sub-objects _before_
the rest of the object is constructed, in my understanding this is
clearly implying that it changes the order of construction.

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

Exactly, it's being used to effect which constructor of the object is
called, NOT to effect the ordering of construction of the sub-objects
(which is implementation defined).

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

No, I was interpreting the answer to mean that by using an intializer
list you can change the ORDER of construction.

: : Second, on question number 16, yes it's obvious that class Y has two...

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

What would it matter what access protections the baseclass has then?
Private, or "super-private", Y would still have the same number of
data 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".

With the additional statement to consider all access protections, this
is what the question seems to imply. If the access protections were
irrelevant to the question, then the statement in parenthesis is
not needed and just misleading.

Follow Ups:

Post a Followup




Optional Link URL:
Link Title:
Optional Image URL:

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