I convert one of my Java class to Kotlin and the class as below.
class MainApplication : Application() {
companion object {
operator fun get(cont
By omitting the name of your companion object, the name Companion
must be used to access the methods.
Example:
class MyClass1 {
companion object Object1 {
fun method1 {
}
}
}
class MyClass2 {
companion object {
fun method2 {
}
}
}
To invoke the first companion object method you would do the following:
MyClass1.method1()
To invoke the second:
MyClass2.Companion.method2()
See the Kotlin docs on Companion Objects for details.