diff --git a/src/main/java/com/github/hcsp/polymorphism/Main.java b/src/main/java/com/github/hcsp/polymorphism/Main.java index fe62227..19fb157 100644 --- a/src/main/java/com/github/hcsp/polymorphism/Main.java +++ b/src/main/java/com/github/hcsp/polymorphism/Main.java @@ -6,7 +6,8 @@ public class Main { // "I am Sub, the param is ParamSub" public static void main(String[] args) { Base object = new Sub(); - ParamBase param = new ParamSub(); + ParamSub param = new ParamSub(); object.print(param); + } } diff --git a/src/main/java/com/github/hcsp/polymorphism/Sub.java b/src/main/java/com/github/hcsp/polymorphism/Sub.java index 5ead475..e4a0abf 100644 --- a/src/main/java/com/github/hcsp/polymorphism/Sub.java +++ b/src/main/java/com/github/hcsp/polymorphism/Sub.java @@ -10,4 +10,5 @@ public void print(ParamBase param) { public void print(ParamSub param) { System.out.println("I am Sub, the param is ParamSub"); } + public void println(){} }