No, because while C
inherits from B
, A<C>
does not inherit from A<B>
.
To understand why this is so, imagine if there were List<T>
instead of A<T>
List<T>
:
class B { } class C : B { } class D : B { } class My1 { public My1(List<B> lessDerivedTemplateParameter) {
Now, on the other hand, this is legal:
interface IA<out T> { public T GetSome(); } class B { } class C : B { } class D : B { } class My1 { public My1(IA<B> lessDerivedTemplateParameter) {
source share