Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning object or arrays from within functions, method
Message
De
30/09/1996 09:44:54
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00008798
Message ID:
00008831
Vues:
28
>>Does anyone know how to return an array or an object reference from within a method or function or procedure?
>>
>>The folowing code is an example of what does not seem to work:
>>
>>FUNCTION Start
>>DIMESION aTest(2)
>>aTest[1] = 1
>>aTest[2] = 2
>>*--- CALL TO PROCEDURE TO RETURN ARRAY
>>aTest2 = RetArray(aTest)
>>
>>? aTest2[1]
>>? aTest2[2]
>>RETURN
>>
>>FUNCTION RetArray(aRry)
>>aRry[1] = aRry[1] + 1
>>aRry[2] = aRry[2] - 2
>>RETURN aRry
>>
>>
>>
>>*--- THE CODE ABOVE DOES NOT RETURN AN ARRAY. It returns what looks to be the first element in the array.
>>
>>Anyone know how to do this?!!!!
>>
>>
>>.
>
>pass the array by reference. =RetArray(@aTest) will do what you're looking for...

>> Surely, passing by reference resolves the problem. But the consistent (object-oriented) way is to create property-array and handle it throughout all its scope not to worry about passing to methods,procedures etc.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform