In Scala, a class paired with a same-named companion object in the appropriate source context. They can access each other's private members. This permits a companion object to hide implementation-node definitions while the corresponding class creates and manipulates those nodes.[ref]
Scala 2.13 classes and objects specification. Private modifier and companion access
Articles by others on the same topic
There are currently no matching articles.