If the parameter value is destroyed upon exit, then if we pass an local argument as parameter and whatever changes we to it inside the maethod would not be saved ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If the parameter value is destroyed upon exit, then if we pass an local argument as parameter and whatever changes we to it inside the maethod would not be saved ?

9th Aug 2016, 12:30 PM
Antony Stinil
Antony Stinil - avatar
2 Answers
+ 2
Nope. Everything will be destroyed upon exit. No matter what. There are other ways to store data which I can't explain here but you can google them. like writing app.config or external files or using data bases and so on.
10th Aug 2016, 7:46 AM
Alireza M
Alireza M - avatar
0
Yes and no. Upon exit of a function all parameters are destroyed and all changes are lost if they are not declared as ref parameters. Changes for ref parameters propagate outside. Moreover, note that for reference types only changes to the reference are lost. All changes to the referenced object persist. (Basically, the reference is the argument.)
21st Aug 2016, 1:27 PM
Max Dörner