I ran the code (with minor modifications). The object created in the m1 method is the only one that gets garbage collected. I was incorrect when I said the c1 variable's reference would change...
Type: Posts; User: aussiemcgr
I ran the code (with minor modifications). The object created in the m1 method is the only one that gets garbage collected. I was incorrect when I said the c1 variable's reference would change...
No, I think the answer is correct.
We start off by initializing c1 to some C object (we'll call this: original_c1).
We then initialize c2 by calling the m1() method. The m1 method takes c1 as the...