Scala Interview Question: How Do Companion Objects Enhance Scala Classes?

Описание к видео Scala Interview Question: How Do Companion Objects Enhance Scala Classes?

Companion objects are those objects that have the same name as that of the class. So if a object name is singletonExample and its class name is also singletonExample, we say that the object is a companion object and the class is a companion class. Now what is the speciality of this? Well companion object and companion class can use each other’s private variables.

Комментарии

Информация по комментариям в разработке