Jump to content

Pointers and references: Difference between revisions

No edit summary
Line 921:
}
GroupPointers
</lang>
====Reference of members of Groups====
We can pass reference from group members, if group has a name.
<lang M2000 Interpreter>
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
</lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.