68 lines
1.2 KiB
Plaintext
68 lines
1.2 KiB
Plaintext
Class PointA {
|
|
X=0~, Y=0~
|
|
Module Print {
|
|
Print "Point" , .x, .y
|
|
}
|
|
Class:
|
|
Module PointA {
|
|
Read ? .x, .y
|
|
}
|
|
}
|
|
Class Circle {
|
|
Property R {
|
|
Value,
|
|
Set {
|
|
If Value>1000 then Value=1000
|
|
}
|
|
}=300~
|
|
Module Print {
|
|
Print "Circle", .x, .y, .r
|
|
}
|
|
Class:
|
|
Module Circle {
|
|
if match("nn") then {
|
|
M=PointA(Number, Number)
|
|
} Else.if match("G") then {
|
|
M=PointA()
|
|
Read M
|
|
} Else M=PointA()
|
|
M=This
|
|
This=M
|
|
Read ? .r
|
|
}
|
|
}
|
|
A=PointA(10,3)
|
|
C=Circle(20,10,5)
|
|
D=Circle(A, 100)
|
|
B=A
|
|
K=PointA()
|
|
Z=Circle(A)
|
|
P=PointA(600,700)
|
|
|
|
\\ N is a pointer to stack
|
|
N=Stack:=A, B, C, D, K, P, Z
|
|
\\ M is a pointer to an iterator
|
|
M=each(N)
|
|
While M {
|
|
For This {
|
|
\\ a copy in MM
|
|
MM=StackItem(M)
|
|
MM.Print
|
|
}
|
|
}
|
|
\\ NN is a pointer to Inventory
|
|
Inventory NN= 1:=A, 2:=B, 3:=C, 4:=D, 5:=K, 6:=P,7:= Z
|
|
M=each(NN)
|
|
While M {
|
|
For This {
|
|
\\ a copy in MM
|
|
MM=Eval(M)
|
|
MM.Print
|
|
}
|
|
}
|
|
\\ we can call NN(3).print
|
|
Print "NN(3).Print"
|
|
NN(3).Print
|
|
NN(3).R=5000
|
|
NN(3).Print
|