Matej Drobnič
11/09/2020, 11:52 AMT is String
* out T means that String or any of its subtypes can fit this
* Since String in methodB matches that, why I can't pass methodB into methodA?Petter Måhlén
11/09/2020, 12:01 PMmethodA needs a container out String as its parameter, and you’re passing in a container String , which isn’t the same. if the container data class was defined as out T , and methods A and B just specified as T, I think it would be different. in both the cases. i don’t have the time right now to work it all out, but that would be my guess 🙂Tomasz Krakowiak
11/09/2020, 12:35 PMTomasz Krakowiak
11/09/2020, 12:39 PMdata class Container<T>(var value: T)
fun methodB(input: Container<String>) {
input.value = "B"
}Matej Drobnič
11/09/2020, 12:40 PMMatej Drobnič
11/09/2020, 12:40 PM