Atul Gupta
12/16/2025, 9:30 PMB.INSTANCE.foo() is not allwoed but A.Companion.foo() is allowed. Code in 🧵
Also let me know if this is not a correct channelAtul Gupta
12/16/2025, 9:30 PMclass A {
companion object {
fun foo() = 1
}
}
object B {
fun foo() = 1
}jw
12/17/2025, 12:47 AMjw
12/17/2025, 12:47 AMZach Klippenstein (he/him) [MOD]
12/17/2025, 6:34 PMINSTANCE thing in Kotlin. Companion is just the name of the companion object, which is optional when referring to its members (you can just do A.foo().Zach Klippenstein (he/him) [MOD]
12/17/2025, 6:35 PMB.INSTANCE.foo() would refer to would be:
object B {
object INSTANCE {
fun foo() = 1
}
}
But this would be pretty weird to see.jw
12/17/2025, 6:36 PMAtul Gupta
12/18/2025, 3:20 PM