The Inheritance of Polymorphism
The characteristics of the inheritance of polymorphism is the subclass type turn to the superclass type
class Father{
}
class Child extends Father{
}
public class MyClass{
main(){
Child a = new Child();
Father b = new Father();
test(a);
}
public static void test(Father b){
}
}
class abstract Father{
}
class Child extends Father{
}
public class MyClass{
main(){
Child a = new Child();
Father b = new Father();
test(a);
}
public static void test(Father b){
}
}