2
Answers

Simple Question: Reference vs. Value

Ask a question
Henry

Henry

16y
2k
1
So, I've got a class called Soldier, and I'm trying to create a seperate copy of it basically.  But since classes assign through reference, whenever I create a new soldier, and set it as the old one, they both point to the same instance.  I'm wondering if there's anyway to just, copy all of the values over into a new Soldier class.

Answers (2)