📄 base.java
字号:
package net.betterjava.design.over;
public class Base {
void Iam(Base b) {
System.out.println("Base;Overload");
}
void Iam(Child c) {
System.out.println("Child;Overload");
}
public static void main(String[] args) {
Base[] test = new Base[] { new Base(), new Child()};
for (int i = 0; i < test.length; i++)
test[i].Iam(new Child());
}
}
class Child extends Base {
void Iam(Base b) {
System.out.println("Base;Override");
}
void Iam(Child c) {
System.out.println("Child;Override");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -