A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
3
Task/Break-OO-privacy/Factor/break-oo-privacy-1.factor
Normal file
3
Task/Break-OO-privacy/Factor/break-oo-privacy-1.factor
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
( scratchpad ) USING: sets sets.private ;
|
||||
( scratchpad ) { 1 2 3 } { 1 2 4 } sequence/tester count .
|
||||
2
|
||||
3
Task/Break-OO-privacy/Factor/break-oo-privacy-2.factor
Normal file
3
Task/Break-OO-privacy/Factor/break-oo-privacy-2.factor
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
( scratchpad ) USE: sets
|
||||
( scratchpad ) { 1 2 3 } { 1 2 4 } intersect length .
|
||||
2
|
||||
17
Task/Break-OO-privacy/Factor/break-oo-privacy-3.factor
Normal file
17
Task/Break-OO-privacy/Factor/break-oo-privacy-3.factor
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
link printf
|
||||
|
||||
procedure main()
|
||||
(x := foo(1,2,3)).print() # create and show a foo
|
||||
printf("Fieldnames of foo x : ") # show fieldnames
|
||||
every printf(" %i",fieldnames(x)) # __s (self), __m (methods), vars
|
||||
printf("\n")
|
||||
printf("var 1 of foo x = %i\n", x.var1) # read var1 from outside x
|
||||
x.var1 := -1 # change var1 from outside x
|
||||
x.print() # show we changed it
|
||||
end
|
||||
|
||||
class foo(var1,var2,var3) # class with no set/read methods
|
||||
method print()
|
||||
printf("foo var1=%i, var2=%i, var3=%i\n",var1,var2,var3)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue