package cn.itcast;
public class Test3 {
public static void main(String[] args) {
B b = new B();
// C.show(new B());
C.show(b);
}
}
abstract class A {
public static void showa(){
System.out.println("A");
}
}
class B extends A {
public static void showa() {
System.out.println("B");
}
}
class C {
public static void show(A a) {// 实质就是多态
a.showa();
}
}
|
|