Jon Bailey
04/23/2024, 7:37 PMobject Foo {
object Bar {
val value = ""
}
}
val t = Foo.Bar.value
But if I put an object in a companion object then it doesn't work as smoothly:
class Foo {
companion object {
object Bar {
val value = ""
}
val fooValue = ""
}
}
val t1 = Foo.fooValue
val t2 = Foo.Companion.Bar.value
val t3 = Foo.Bar.value // This doesn't work, unlike t1 and t2
ephemient
04/23/2024, 7:49 PMclass Foo {
companion object {
object Bar
}
object Bar
}
Foo.Companion.Bar
!= Foo.Bar
Jon Bailey
04/23/2024, 9:18 PM