class test1{
//Body1...
public void fun(){
//Body2...
}
}
class test2 extends test1{
//Body3...
public void fun(){
//Body4...
}
}
class test3{
public static void main(String [] args){
test1 test = new test2();//test实际类为test2而引用类为test1
//test1 test = (test1) new test2();是否跟上一行一样?
t1.fun();//调用实际类test2的fun();
(test1)test.fun();//为什么强制类型转换后还调用的test2的fun();?
}
}