+ 3

I don't quite follow on the "By Value" and the "By reference". What happens and what is the difference exactly? :-)

15th Apr 2016, 4:05 PM
Mike Mortensen
Mike Mortensen - avatar
3 Respuestas
+ 5
"By Value" means that you operate on the "value" of the argument passed to the method. This means that whatever change you make to this argument inside the method is *not* going to affect the "original" value of the argument. "By reference" is kind of the opposite: you don't operate on the value of the argument passed; you operate on the argument itself. This means that whatever change you make to this argument inside the method *is* going to affect the "original" value of the argument.
29th Apr 2016, 8:46 PM
Mark
+ 1
By value will use only values of variables without opportunity to change them in method. By reference can do that tweak.
19th Apr 2016, 2:22 PM
Anton Khvorov
Anton Khvorov - avatar
0
I actually just noticed that since I've posted this question I have gained more knowledgr on the topic and understand this. I suggest that everyone, who comes across this should read the comment from Mark as he explains it simple and true :-)
8th May 2017, 12:36 AM
Mike Mortensen
Mike Mortensen - avatar