package ch4;
//通过Son类和Son类重写print()方法,演示在继承关系中的多态性
public class Base {
    public void print(){
        System.out.println("In Base ");
    }
    public static void main(String[] args){
        test(new Base());
        test(new Son());
        test(new Son1());
    }
    static void test(Base base){
        base.print();
    }
}
class Son extends Base{
    public void print(){
        System.out.println("In Son ");
    }
}
class Son1 extends Base{
    public void print(){
        System.out.println("In Son1 ");
    }
}
 
 
                     
            
        













 
                    

 
                 
                    