[Kotlin/en] correct object clarification (#2413)

* Kotlin: correct object clarification

* Kotlin: correct object clarification
This commit is contained in:
Sergey Mashkov 2016-10-05 13:27:41 +03:00 committed by ven
parent 6977b86db7
commit 2fa414912e

View File

@ -337,7 +337,7 @@ enum class EnumExample {
/* /*
The "object" keyword can be used to create singleton objects. The "object" keyword can be used to create singleton objects.
We cannot assign it to a variable, but we can refer to it by its name. We cannot instantiate it but we can refer to its unique instance by its name.
This is similar to Scala singleton objects. This is similar to Scala singleton objects.
*/ */
object ObjectExample { object ObjectExample {
@ -346,6 +346,11 @@ object ObjectExample {
} }
} }
fun useObject() {
ObjectExample.hello()
val someRef: Any = ObjectExample // we use objects name just as is
}
``` ```
### Further Reading ### Further Reading