Not yet Ismael
Please read again the following statement:
Originally posted by Stevi Deter:
B and TestClass are not in the same package as Object, so they cannot see the protected java.lang.Object.clone() member that is inherited by A through extending Object.
Horri quoted a sentence from K&B but dispite I find that book marvellous, I think it's not enough clear on this point. Try to read: whereas a protected member can be accessed (through inheritance) by a subclass
as whereas a protected member can be accessed (through DIRECT inheritance) by ITS FIRST subclass
(To be honest, they point this clearly out some lines after)
Moreover, if you read the last sentence well, you can see that protected members are just defined as VISIBLE and not as INHERITED as most think.
In your hierarchy, A comes right after Object. All the subsequent subclasses have to pass through A to reach Object members. And as long as both A, B and TestClass are in a different package from Object, A is THE ONLY class allowed to SEE protected Object members. But still A doesn't have a clone() method. It can just use it.
IF (but only IF, and this is NOT the case) all the four classes where in the same package (A, B, TestClass and A's ancestor), you example could work.
Hope it's clearer now.
[ April 27, 2008: Message edited by: Francesco Bianchi ]