summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--kotlin.html.markdown7
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