RosettaCodeData/Task/Pointers-and-references/M2000-Interpreter/pointers-and-references-7.m2000
2023-07-01 13:44:08 -04:00

38 lines
916 B
Text

Module CheckGroupRef {
Group TestMe {
Private:
acc=1
Public:
Function GetAcc {=.acc}
Group Y {
Property Name$ {Value}="TestMe"
Value {
link parent [x] to x
=100*x
}
Set {
read x
Link parent acc to acc
acc+=x
}
}
Property X { Value }=100
Function GetValue(x) {
=.[X]*x
.[X]++
}
}
Module GetIt (&Fun()) {
Print Fun(30)
}
GetIt &TestMe.GetValue() ' 3000
Print TestMe.X=101
Module ByRef (&What){
Print What, What.Name$
What=30
}
ByRef &TestMe.Y
Print TestMe.GetAcc()=31
}
CheckGroupRef