class Base{
//try public , then ok
private void amethod(int iBase){
System.out.println("Base.amethod");
}
}
class Abs extends Base{
public static void main(
String argv[]){
Abs o = new Abs();
int iBase=0;
o.amethod(iBase);
Base b= new Abs();
b.amethod(iBase);
}
public void amethod(int iOver){
System.out.println("Over.amethod");
}
}//
//this code will cause complie error at b.amethod(iBase);
//question is: b is actually an Abs obj with an overriden method, why the error?
//and if you change the Base's method to public, it works fine
can somebody explain to me why?
thanks!