已经定义B类型
class A1 {public void fun1(){
System. out.println("A-->public void fun1(){}");
}
public void fun2(){
this .fun1 ();
}
};
class B extends A1{
—
已经定义类型B
public void fun1(){
System.out.println("B-->public void funl(){}");
}
public void fun3(){
System.out.println("B-->public void fun3(){}");
}
};
class PolDemo02{
public static void main(String[] args){
A a = (A) new B();
B b =(B)a;
b.fun1();
b.fun2();
b.fun3();
}
}