Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing object array
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01668317
Message ID:
01668323
Vues:
77
I'm confused as to what's happening here with this code that is a little different that Rick S.'s code. I'm making the original array a LOCAL and I rebuild the loObj a second time and use "aItems[2]" instead of "aItems[1]".

When I run it through the debugger and step into the CallMethod and examine all the variables "loObj" in that method, I got .aItems[1]='Rick' and .aItems[2]='Rick'. I was expecting to see 'Markus' to be in .aItems[2] during in the 2nd call.

local laItems[2],x

laItems[1] = "Rick"
laItems[2] = "Markus"
*******************************First Call
loObj = CREATE("Empty")
ADDPROPERTY(loObj,"aItems[1]",laItems)
SET STEP ON
x= CallMethod(loObj)
?x

loObj = .null.
release loObj

*******************************Second Call
loObj = CREATE("Empty")
ADDPROPERTY(loObj,"aItems[2]",laItems)
SET STEP ON
x= CallMethod(loObj)
?x


RETURN

FUNCTION CallMethod(loObj)
local x as Object
x = loObj.aItems[1]
try
?x
catch
endtry

return x
*return loObj.aItems[1]
ENDFUNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform