summaryrefslogtreecommitdiff
path: root/ipl/packs/loadfuncpp/doc/object.icn
blob: 5fe2ba475827cb2a11fcd069cc639c951aa05c83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

link loadfuncpp

record object(val, print)

procedure print()
	obj := self() | fail
	write( obj.val )
end

procedure newObject(x)
	obj := object(x) #don't assign print method yet
	#print will be a copy bound to the record it's embedded in
	obj.print := bindself(print, obj)
	return obj
end

procedure main()
	obj := newObject("Hello")
	obj.print()	
end