Vague
06/04/2019, 1:47 PMCompanion Object
and using an Object Declaration
?Shawn
06/04/2019, 1:49 PMVague
06/04/2019, 1:52 PMShawn
06/04/2019, 1:52 PMShawn
06/04/2019, 1:54 PMclass Foo {
companion object {
fun bar() {}
}
}
is rather different from this
class Foo {
val fieldObject = object {
fun bar() {}
}
}
Shawn
06/04/2019, 1:55 PMFoo.bar()
, the latter does notearroyoron
06/04/2019, 2:14 PMfun
out of a class… it will belong to package without a class and is static. It’s more “kotlin-way”Vague
06/04/2019, 2:18 PMobject
?Shawn
06/04/2019, 2:28 PMearroyoron
06/04/2019, 6:37 PM