[java]代码库
public class ParentClass {
}
public class ChildClass extends ParentClass{
}
public class Test {
public void testOverLoad(ParentClass cls){
System.out.println("It's ParentClass");
}
public void testOverLoad(ChildClass cls){
System.out.println("It's ChildClass");
}
public static void main(String[] args) {
Test test = new Test();
ParentClass parentCls = new ParentClass();
ParentClass childCls = new ChildClass();
test.testOverLoad(parentCls);
test.testOverLoad(childCls);
}
}//源代码片段来自云代码http://yuncode.net