Originally posted by Layne Lund:
I don't have the K&B book yet, so I'm not sure how it addresses this issue.
Well, is just doesn't. There is an explanation about the differences between inherited access, direct access and reference access. After that some cases are described. On page 36 they write in bold:
For a subclass outside the package, the protected member can be accessed only through inheritance. A few pages before that, inheritance access was defined as code accessing an inherited member through the this reference (using this either implicit or explicit). Clearly, when accessing a member through the reference of another instance we're not using "this" in anyway.
Therefore, the K&B reading is slightly misleading, or atleast incomplete. But maybe this is mentioned in the book elsewhere. I haven't read all chapters yet.
Notice that you can do this same thing with private members. It seems to me that these issues would fit more under describing how private access works and then some disclaimer like "protected members can be accessed the same way private members can plus..."
You're right. Something like that would do.