Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Singleton/Groovy/singleton-1.groovy
Normal file
11
Task/Singleton/Groovy/singleton-1.groovy
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@Singleton
|
||||
class SingletonClass {
|
||||
|
||||
def invokeMe() {
|
||||
println 'invoking method of a singleton class'
|
||||
}
|
||||
|
||||
static void main(def args) {
|
||||
SingletonClass.instance.invokeMe()
|
||||
}
|
||||
}
|
||||
13
Task/Singleton/Groovy/singleton-2.groovy
Normal file
13
Task/Singleton/Groovy/singleton-2.groovy
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class Singleton
|
||||
method print()
|
||||
write("Hi there.")
|
||||
end
|
||||
initially
|
||||
write("In constructor!")
|
||||
Singleton := create |self
|
||||
end
|
||||
|
||||
procedure main()
|
||||
Singleton().print()
|
||||
Singleton().print()
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue