ho lezioneCome controllare il tipo generico in Kotlin?
class Generic<T : SuperType>()
e questo codice is't corretto
fun typeCheck(s: SuperType): Unit {
when(s){
is T -> //do some thin
}
}
ma gettata s
digitare T
s as T
Mostra avviso - getto pericoloso.
Come verificare che s
sia il tipo T
?
La stringa è definitiva, perché dovresti usare 'T: String'? –
@cypressious è solo un esempio – andreich