From 2fa414912e2fd9bdcd8fd5aa6df59e70f24dac06 Mon Sep 17 00:00:00 2001 From: Sergey Mashkov Date: Wed, 5 Oct 2016 13:27:41 +0300 Subject: [PATCH] [Kotlin/en] correct object clarification (#2413) * Kotlin: correct object clarification * Kotlin: correct object clarification --- kotlin.html.markdown | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kotlin.html.markdown b/kotlin.html.markdown index 00182d81..4c2f3082 100644 --- a/kotlin.html.markdown +++ b/kotlin.html.markdown @@ -337,7 +337,7 @@ enum class EnumExample { /* 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. */ 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