Companion Object in Scala
Reading Time: 4 minutes Companion Object is a singleton object of a class sharing same name and same source file.The class is called a Companion Class.For instance, we have a class name Person in Person.scala and an singleton object Person in the same file: In this file the object Person is a companion object and class Person is a companion class. Benefits of Companion Object Companion Objects in Scala gives many benefits.First, companion object and class can access each Continue Reading