class A {} interface IA{ void foo(A x); } interface IB{ int foo(A x); } class C { void bar(T x, A y){ int z = x.foo(y); } }