interface I { String foo (); }
class C implements I { .. String foo () { .. } }
class D implements I { .. String foo () { .. } }
class Top {
void check (I x) {
System.out.println (x.foo ());
}
}
Die Methode check ist polymorph:
zur Laufzeit ist das Argument x
von irgendeinem Typ, der I implementiert.