Consider the following codes :
File : C3.java
package G;
public class C3
{
protected int a=5;
}
File : R3.java
import G.C3;
class R2 extends C3
{
void doit()
{
a=7;
}
}
class R1 extends R2
{
void doit(R2 b)
{
a=8;
b.a=1; // (1)
}
}
It gives an error in (1) stating that "a" has protected access in G.C3
"b" is and object of R2 which extends C.R3. Why can't we use "b" to access R2's protected member "a" ?