24 lines
266 B
Text
24 lines
266 B
Text
a = new()
|
|
a.f = method(){
|
|
.x.print()
|
|
}
|
|
|
|
c = new()
|
|
c.g = method(){
|
|
(.x + 1).print()
|
|
}
|
|
|
|
# array of delegates
|
|
b = new()
|
|
b.delegate = new()
|
|
b.delegate[0] = a
|
|
b.delegate[1] = c
|
|
b.x = 3
|
|
b.f()
|
|
b.g()
|
|
|
|
# single delegate
|
|
d = new()
|
|
d.delegate = a
|
|
d.x = 7
|
|
d.f()
|