Tech Tip: Proper syntax for calling class functions on a pointer to collection
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: December 2, 2024
When working with a pointer to a collection, to call a class function on the pointer, the dereferenced pointer must be enclosed by parentheses. For example, suppose there is a collection of integers:
$myColl:=New collection(4; 712; 55) |
and a pointer to that collection:
$ptr:=->$myColl |
To get the size (.length) and maximum value (.max) of the collection from the pointer, make sure that the dereferenced pointer is surrounded by parentheses:
$size:=($ptr->).length // 3 $maxValue:=($ptr->).max() // 712 |