public class Cons
{
public static void main(String[] args)
{
A a1 = new A();
A a2 = new B();
B b = new B();
C c = new C();
D d = new D();
System.out.println(a2.show(b)); // ????????????
}
}
class A {
public String show(D obj) {
return ("A and D");
}
public String show(A obj) { return ("A and A"); } public String show(C obj) { return ("A and C"); }
}
class B extends A {
public String show(B obj) {
return ("B and B");
}
public String show(A obj) { return ("B and A"); } public String show(C obj) { return ("B and C"); }
}
class C extends B {
}
class D extends B {
}
小怪兽爱吃肉
凤凰求蛊
天涯尽头无女友
眼眸繁星
慕妹3146593
红糖糍粑
守着星空守着你
相关分类