Описание тега companion-object
In [tag:Scala], an object with the same name as a class, used to hold utility members for the class
In scala, a companion object is an object
with the same fully qualified name as a class. Companion objects are used to hold utility members that apply to all instances of the class. These can include constants, factory-method s (apply
), and implicit-conversion s. They are often used as a replacement for Java's static-members.