In Kotlin, if you need to write a code for a function that can be called without a class instance but it needs access to the internals of a class, you can use a companion object declaration in that specific class.

BY Best Interview Question ON 21 Jul 2020


class EventsManager {
    companion object FirebasesManager {     
val firebasesManager = EventsManager.FirebasesManager