I have two C++ functions in a class:
void Attribute::setIndex(int inIndex) {
    if (inIndex < 0) {
        index = 0;
    }
    else if (inIndex >= MAX_NUM_ATTRIBUTES) {
        index = MAX_NUM_ATTRIBUTES - 1;
    }
    else {
        index = inIndex;
    }
}
and
int Attribute::getValueWithinRange(int value) {
    value = setIndex(value);
    return value;
}
The second function is supposed to use setIndex to set 'value' to the correct number and return it. However, since the first function is a void function, i cannot simply pas the value in the way i did above. Should i do pass by reference or are there any suggestions? Thank you very much.
 
     
     
    