singleton in kotlin example
Example: Kotlin singleton
object MySingleton {
fun myMethod(): Int {
return 5
}
}
MySingleton.myMethod() // 5
object MySingleton {
fun myMethod(): Int {
return 5
}
}
MySingleton.myMethod() // 5