Reputation: 1235
Let's say i have 4 previously instantiated objects called o1
, o2
, o3
, o4
of type T
.
I also have one reference variable called vForAll
of type T
.
First I store o1 in vForAll as
VForAll = o1;
Then I want to store o2
in vForAll
without doing any affect on the o1
object and so on!
What can I do?
Upvotes: 0
Views: 278
Reputation: 466
When you do vForAll = o2, vForAll will no longer point to o1, but o2. Any changes you now make will only affect o2.
Want to change o1 after that, just do a vForAll = o1.
Upvotes: 0
Reputation: 4399
If I understand the question correctly, if o1, o2, o3, o4
are just reference types, doing vForAll = o2
should do the trick. The o1
will not be modified.
Upvotes: 2