Posted by Amit Nithian on April 05, 2001 at 16:47:02:
In Reply to: Re: Questions on latest homework answers posted by William D McQuain on April 05, 2001 at 08:21:55:
: : 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.
I agree with this statement. If the question was simply asking how many data members does Y have, then there should not be any need to consider the "access protections." This is like the question on the first homework regarding an integer, the answer was base 16 when I thought that it was arguable that base 10 representation was alright too. If Y has 2 data members, then we don't need to consider access protections at all, Y simply has 2 data members. In concerning access protections, it would seem to me that it would imply how many accessible data members Y has, in that case, the answer would be 1, the data member declared in Y header file.
- Amit Nithian
Post a Followup