Singleton: Difference between revisions
Content deleted Content added
No edit summary |
Add Nimrod |
||
Line 1,035:
Thread-4________:0000000013:@457471e0|0
</pre>
=={{header|Nimrod}}==
In the file <code>singleton.nim</code> we don't export the type, so new objects can't be created:
<lang nimrod>type Singleton = object # Singleton* would export
foo*: int
var single* = Singleton(foo: 0)</lang>
Then in another file we can use the singleton object:
<lang nimrod>import singleton
single.foo = 12
echo single.foo</lang>
=={{header|Objeck}}==
|