114Fermer116
Kevin KoflerLe 07/05/2008 à 10:02
BiHi (./109) :
For instance, as just one random illustrative example, you might need to return 2 values from a function in Java (a language with no direct support for multiple return values). Should you model it as a MyFunctionCallResult class with named ValueOne and ValueTwo fields (presumably with actual names appropriate to the problem at hand)? Or should you just return a 2-element array (possibly of mixed types) and have the caller unpack it?

Personnellement, je ferais une méthode de signature (par exemple) bool func(int ret1[], double ret2[])ret1 et ret2 doivent être des tableaux à 1 élément, mais ça doit être l'habitude du C et du passage par pointeur. smile