Suppose I have this in C++:
void test(int &i, int &j)
{
++i;
++j;
}
The values are altered inside the function and then use
Well, there are a couple of workarounds. You mentioned one yourself. Another one would be:
public void test(int[] values) {
++values[0];
++values[1];
}
I would go with the custom object, though. It’s a much cleaner way. Also, try to re-arrange your problem so that a single method doesn’t need to return two values.