Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning an Array from a Function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00338850
Message ID:
00339077
Vues:
28
>This brings up an interesting point (at least to me).
>
>The default behavior for parameter passing is by value unless specified. What happens when you pass an object to a function in the () like:
>something = myfunc(myobject)
>
>Is myobject passed by reference and therefore all the changes I make to it are reflected in the passed copy? Or do I have to explicitly pass it by reference using the @? Or do I have to return it after the changes are made?
>myobject = myfunc(myobject) will effectively remake the object.

As Nigel mentioned, objects, regardless of the setting of SET UDFPARMS, are always passed by reference. If any modifications are made in the procedure/function called via = myfunc(myobject) to the object are accordingly reflected in the object when the procedure/function terminates. The @ symbol is not necessary.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform