Information générale
Catégorie:
Codage, syntaxe et commandes
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement