-
Notifications
You must be signed in to change notification settings - Fork 2
unique
soliton4 edited this page Dec 7, 2014
·
1 revision
#unique - type modifier
Stability: 3 - Stable
- [dynamic type safety](dynamic type safety)
this modifier causes the first constructor parameter to be used as id.
there is also a implicit member "id" created.
there can only exist one instance per id.
if you create a second instance with the same id it will refer to the original instance.
class type unique Singleton {
};
Singleton a = new Singleton("myid");
Singleton b = new Singleton("myid"); // is the same object as a;
Singleton c = new Singleton("otherid"); // a seperate instance;
var id = c.id; // "otherid"
create singletons
continue reading about the savable modifier.
found any errors?
missing something?
let me know