Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I pass an object property by reference?
Message
De
27/02/2001 23:45:13
 
 
À
27/02/2001 17:07:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00480283
Message ID:
00480403
Vues:
8
>God bless you George. The precise answers you've given me over time have always been precise and precious. Thank you very much for your time.
>
>Now, I don't know about you, but I find that not being able to pass object properties by reference directly in VFP is ridiculous! This is the first time I've encountered such a thing. Why haven't the programmers at MS thought of this issue. Is this done on purpose or is it a not-so-common thing that nobody uses? Even so, I think it would be very useful to allow parameters being passed by reference in every possible way.
>

You can't pass any object property by reference; you have to pass the object reference instead. This makes some sense, since you have to update the object if a change is made to a property passed by reference. It may be annoying, but it is consistant.

>Stephane.
>
>
>>>Hi
>>>
>>>I have a form with an array as a property. What I want to do is pass this array to a function that will fill it. Sometimes, the array will be changed either by adding a new row or even new columns. So, what I need to do is pass this form property (my array) by reference to the function. Here's what I tried:
>>>
>>>nPos = afill(@THISFORM.aClients)
>>>
>>>This didn't work. I'm guessing it's because of the '@' but I don't know the exact grammatical structure that my command should have. Please help me out!
>>>
>>>Thanks a lot in advance, Stephane.
>>
>>Stephane,
>>
>>You can't. Make a copy of the array using ACOPY(), pass that, then update the original. Alternately, you could pass the entire object.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform