Associative array as a method arg

Started by ChrisKCAi, May 28, 2020, 09:20:50 AM

Previous topic - Next topic

ChrisKCAi

PxPlus 15.10
Is there a way to pass an associative array as an argument to an object method?

Mike King

You can do it if in the function definition you declare varname${All} as in the following object:

def class "a"
  function dump(v${all})
  enter var${all}
  dump
  return 1
end def


You can then use it as follows:

  begin
  abc$["first"]="one"
  abc$["second"]="two"
  a=new("a")
  a'Dump(abc${all})

Mike King
President - BBSysco Consulting - http://www.bbsysco.com
eMail: mike.king@bbsysco.com