Understanding this UML diagram?

I have an assignment which comes with a UML diagram but I'm having trouble understanding one line:

+ solve(INOUT solution: JumpSequence): boolean

What does "INOUT" mean? My guess is that it means the variable goes both in and out since the previous functions in the UML diagram were labled only as "IN", like this:

- canJump(IN fromRow: int, IN fromCol: int, IN whichWay: Direction): boolean

On a separate note, what does OUT mean? How is a parameter passed only out?
INOUT is just to indicate you want use that variable as input and output. So, inside the method you will modify and therefore you'd have to pass for reference.

 
solve(Type & myVariable);


With ampersand(&) you are passing by-refernce, so, it is like the INOUT.
In this way, you don't have to make temporaly copies.
What does it mean to have a variable just OUT? Would that still be
solve(Type & myVariable);
Just out is a tipical return:

outType solve(In/OutType & myVariable);

Using (Type & myVariable) this is in/out. You pass it by reference so if you change the input inside the function you will change it outside

In the case you have an input where you don't have to modify it, use the const with a reference

outType solve(const InType & myVariable);

And:

outType solve(Type myVariableTemporal)
Topic archived. No new replies allowed.