C
Colin Hemmings
Hi there,
I have a game that I am currently developing and I am looking to make
exact copies of the gameState object throughout the run of the game. I
need to do this so that I can do move 'look ahead' but not effect the
actual state of the game.
I was looking at using the clone method of Object, but the API says that
clone only performs a "shallow copy" of the object. The object I will be
looking to clone contains a collection of other objects. I want to make
an exact clone of the gameState object that is completely independent of
the original.
Will clone do this or is there a better way?
I have a game that I am currently developing and I am looking to make
exact copies of the gameState object throughout the run of the game. I
need to do this so that I can do move 'look ahead' but not effect the
actual state of the game.
I was looking at using the clone method of Object, but the API says that
clone only performs a "shallow copy" of the object. The object I will be
looking to clone contains a collection of other objects. I want to make
an exact clone of the gameState object that is completely independent of
the original.
Will clone do this or is there a better way?