Multiple distinct objects: Difference between revisions
Content added Content deleted
(Added Kotlin) |
(→{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details) |
||
Line 670: | Line 670: | ||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
<lang scala>// version 1.1. |
<lang scala>// version 1.1.2 |
||
class Foo { |
class Foo { |
||
Line 678: | Line 678: | ||
id = ++numCreated // creates a distict id for each object |
id = ++numCreated // creates a distict id for each object |
||
} |
} |
||
companion object { |
companion object { |
||
private var numCreated = 0 |
private var numCreated = 0 |