Hi i would like to know how i could copy the contents of a 2d Array pointer in C++ to another location and set another pointer to it so that when i make changes on the copied pointer nothing happens to the original data?
Basically its an array pointer to pieces on a chessboard. so it goes like Piece * oldpointer = board[8][8]
. now i want to copy all the contents in this pointer including methods like getvalue(), getcolor()
etc which are in the Pieces header file to another location and set a pointer to it so i can do operations there and test it without it having to affect this orginal data? I read somewhere i had to use allocate()
but im not sure. please help