Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Singleton/Phix/singleton-1.phix
Normal file
19
Task/Singleton/Phix/singleton-1.phix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- <separate include file>
|
||||
object chk = NULL
|
||||
class singleton
|
||||
public procedure check()
|
||||
if chk==NULL then
|
||||
chk = this
|
||||
elsif this!=chk then
|
||||
?9/0
|
||||
end if
|
||||
?"ok"
|
||||
end procedure
|
||||
end class
|
||||
|
||||
global singleton s = new()
|
||||
--global singleton s2 = new()
|
||||
-- </separate include file>
|
||||
|
||||
s.check()
|
||||
--s2.check() -- dies
|
||||
6
Task/Singleton/Phix/singleton-2.phix
Normal file
6
Task/Singleton/Phix/singleton-2.phix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
global function get_singleton()
|
||||
if chk==NULL then
|
||||
chk = new("singleton")
|
||||
end if
|
||||
return chk
|
||||
end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue