这样竟然直接运行而且没问题?!
public class Initial {
public static void main(String[] args) {
// TODO Auto-generated method stub
/*Transportation tr1=new Bike();
tr1.take();
Transportation tr2=new Motor();
tr2.take();
Transportation tr3=new Bus();
tr3.take();
Transportation tr4=new Ship();
tr4.take();
Transportation tr5=new Plane();
tr5.take();*/
//tr2.hehe(); 不能通过父类的引用调用子类独有的方法
}
Bike bi=new Bike();
Transportation tr=bi;
Bike bi1=(Bike)tr;
Motor mo=(Motor)tr;
}