Inherited shared parameter as function parameter
How can i do this?
class A { }
class B : A { }
class X<T> where T : A { }
class Y<T> : X<T> where T : A { }
private static void f(X<A> x) { }
public static void Main(string[] args)
{
Y<B> y = new Y<B>();
f(y); // Compiler error here
}
Y inherited from X, B from A, but it won't compile.
+3
source to share