diff options
author | Sergey Mashkov <cy6erGn0m@gmail.com> | 2016-10-05 13:27:41 +0300 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2016-10-05 12:27:41 +0200 |
commit | 2fa414912e2fd9bdcd8fd5aa6df59e70f24dac06 (patch) | |
tree | 21713413fede39b69b5835e95ab301bd5df7a1e3 /kotlin.html.markdown | |
parent | 6977b86db77fb52cf0aed278ff9b543eb2e4e43d (diff) |
[Kotlin/en] correct object clarification (#2413)
* Kotlin: correct object clarification
* Kotlin: correct object clarification
Diffstat (limited to 'kotlin.html.markdown')
-rw-r--r-- | kotlin.html.markdown | 7 |
1 files changed, 6 insertions, 1 deletions
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 |