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.