Mohamed Tamer
01/25/2022, 9:21 PMzsmb
01/25/2022, 9:41 PMzsmb
01/25/2022, 9:41 PMCounter
will point to itzsmb
01/25/2022, 9:41 PMobject
entirely, and make Counter
itself an object, if you want it to be a singleton instancepsh
01/27/2022, 6:51 PMobject MySingleton {
}
and
class SomeClass {
companion object {
}
}
The companion object
will get created when the first instance of SomeClass
is created. In the case of the Kotlin singleton object, it will be created when it is first used.