class A{
int i=1;
public void draw(A e){
System.out.printf("AAAA=====%d\n",e.i);
}
}
class B extends A{
int i=2;
public void draw(B e){
System.out.printf("BBBB=====%d\n",e.i);
}
}
class C extends A{
int i=3;
public void draw(C e){
System.out.printf("CCCC=====%d",e.i);
}
}
public class user{
public static void main(String[] args){
A a=new A();
B b=new B();
C c=new C();
a.draw(a);//////输出AAAA=====1
a.draw(b);//////输出AAAA=====1
a.draw(c);//////输出AAAA=====1
b.draw(a);//////输出AAAA=====1
b.draw(b);//////输出BBBB=====2
b.draw(c);//////输出AAAA=====1
c.draw(a);//////输出AAAA=====1
c.draw(b);//////输出AAAA=====1
c.draw(c);//////输出CCCC=====3
}
}
为什么啊,百思不得其解
int i=1;
public void draw(A e){
System.out.printf("AAAA=====%d\n",e.i);
}
}
class B extends A{
int i=2;
public void draw(B e){
System.out.printf("BBBB=====%d\n",e.i);
}
}
class C extends A{
int i=3;
public void draw(C e){
System.out.printf("CCCC=====%d",e.i);
}
}
public class user{
public static void main(String[] args){
A a=new A();
B b=new B();
C c=new C();
a.draw(a);//////输出AAAA=====1
a.draw(b);//////输出AAAA=====1
a.draw(c);//////输出AAAA=====1
b.draw(a);//////输出AAAA=====1
b.draw(b);//////输出BBBB=====2
b.draw(c);//////输出AAAA=====1
c.draw(a);//////输出AAAA=====1
c.draw(b);//////输出AAAA=====1
c.draw(c);//////输出CCCC=====3
}
}
为什么啊,百思不得其解