Why doesn't this give me `null`? ``` sealed class ...
# getting-started
s
Why doesn't this give me
null
?
Copy code
sealed class E {
    data class A(val string : String) : E()
    sealed class B : E() {
        data class C(val int : Int) : B()
    }
}

val x : MutableList<E> = mutableListOf(E.A("a"), E.B.C(1))
println(x as? MutableList<E.B>)
b
Because a
MutableList
will always cast to a
MutableList