Given:
- A class "A" with an %Integer property "intA"
- A class "B" with a classMethod foo(ByRef num As %integer) that gets a parameter byRef and does some calculations.
And knowing that in caché Object Script:
- If you want to pass a parameter by ref you need to put a dot '.' preceding the name of the variable passed by ref.
- Inside a class, if you want to refer to your own properties you need to precede the name of the property with 2 dots '..'
How should I call classMethod foo if I want to pass the property "intA" byRef? Because preceding the property name with 3 dots seems to be not the correct way.
Code Snippet class B:
Class B Extends %RegisteredObject
{
///doubles num
ClassMethod foo(ByRef num As %Integer)
{
set num = num*2
}
}
Code Snippet class A:
Class A Extends %RegisteredObject
{
Property intA As %Integer;
Method test()
{
set ..intA= 5
do ##class(B).foo(..intA)
//If correctly passed by ref, ..intA should be 10, but it is still 5
}
}
Thanks in advance.