kiruthigha rajan wrote: Y:100
4.X: 0 Y:0 //why this is not X:100 and Y:100
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
kiruthigha rajan wrote: Y:100
4.X: 0 Y:0 //why this is not X:100 and Y:100
Quick history (and possibly programming) lesson:
1. 'reference' does NOT mean the same thing in all languages;
and therefore the term "pass by reference" is ambiguous.
Getting back to 'pass by reference': What it usually (and certainly in C/C++ terms) means is: 'pass by memory address',
and in C it comes in the form of the '&' operator
kiruthigha rajan wrote:i didnt understand the program part..can you please explain more precisely
![]()
Joanne Neal wrote:
kiruthigha rajan wrote:i didnt understand the program part..can you please explain more precisely
![]()
Jeff's explanation was pretty precise. Can you be a bit more precise about what you're still not sure about ?
kiruthigha rajan wrote:
Joanne Neal wrote:
kiruthigha rajan wrote:i didnt understand the program part..can you please explain more precisely
![]()
Jeff's explanation was pretty precise. Can you be a bit more precise about what you're still not sure about ?
i didnt understand this line:
Next, tricky() swaps its local variables, so that they point to each others' original objects. This does not affect the caller's copy of those variables.
kiruthigha rajan wrote:i didnt understand the program part..can you please explain more precisely
Jeff Verdegan wrote:
Then, in tricky(), we do this:
That says:
1) Take the value in arg1 and copy it into temp. Now arg1, temp, and pnt1 all refer to the same Point object (Obj1).
2) Take the value in arg2 and copy it into arg1. Now arg1, arg2, and pnt2 all refer to the same Point object (Obj2). Note that putting a different reference value into arg2 does not affect the reference value that's in pnt2, because Java is strictly pass-by-value.
3) Take the value in temp (a reference to Obj1) can copy it into arg2.
| Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |