Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find a flaw in the logic
Message
De
13/01/2006 10:43:51
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
13/01/2006 08:34:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01086027
Message ID:
01086539
Vues:
18
>>>No risk at all since I'm using lparameters and not passing variable by reference.
>>
>>Ah, but, as far as I know, objects are always passed by reference, because the object type variables are references to actual objects. So if you pass an object by value, you do get a new variable, which still refers to the same object.
>>
>>If it wasn't so, your changes to the object would be lost as soon as your code exits - but you know your code works.
>
>Dragan, I think you're mixing us up here. If SET UDFPARMS is set to VALUE and a variable holding an object reference is sent as a parameter in a normal way, then that variable cannot be changed in the called function/procedure/method. If the setting is REFERENCE, then the variable can be changed. I think your usage of 'passed by reference' obfuscates things here.

This is true for any variable - but what is a content of an object reference variable? The reference to an object. And even if you have a copy of such a variable (i.e. passed by value), it only increases the reference count in the object, it doesn't create a copy of the object. So, substantially, an object passed as a parameter is always passed by reference. Or, more precisely, it's passed as a reference.

You can check this yourself - pass thisform by value to any piece of code which will change its caption and see what happens.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform