Debian Codegraph @

ipl/packs/loadfuncpp/doc/object.icn

raw
1
2 link loadfuncpp
3
4 record object(val, print)
5
6 procedure print()
7 obj := self() | fail
8 write( obj.val )
9 end
10
11 procedure newObject(x)
12 obj := object(x) #don't assign print method yet
13 #print will be a copy bound to the record it's embedded in
14 obj.print := bindself(print, obj)
15 return obj
16 end
17
18 procedure main()
19 obj := newObject("Hello")
20 obj.print()
21 end
22
23