Cannot convert generic type to generic element Any / super class

I am trying to understand why I am getting the error in the following code:

class A <T> {}
class B {}
class C : B {}

let a = A<C>() as A<B>

      

While this line of code works:

let b = C() as B

      

+3


source to share





All Articles