Is there any way I can make this work so that anyo...
# announcements
s
Is there any way I can make this work so that anyone accessing
name
on
B
gets a
String
instead of
String?
?
Copy code
open class A(val name: String?)
class B(name: String) : A(name)
fun findName(b: B): String = b.name // errors because `b.name` is `String?`
f
Copy code
open class A(open val name: String?)
class B(override val name: String) : A(name)
That seems to work
s
ahhh awesome, thanks
f
np