Question
What is a companion object?
Select an option. Your answer will be checked instantly.
Correct Answer: C. An object with the same name as a class in the same source file
Explanation:
The class and companion object can access each other's private members.
The object often contains factory methods or constants.
Leave a Reply