If I have a chess board 8x8 And in my copy constructor I want to deep copy it. How would I go about doing it? This is what I have:
public class chessBoard {
private Chess[][]board;
public chessBoard (){
board = new board[8][8];
for (int i = 0; i < 8; i ++){
for (int j = 0; j < 8; j++){
board[i][j] == 0;
}
}
}
//Is this correct implementation of a Deep copy?
public chessBoard(chessBoard other){
board = new board[8][8];
for (int i = 0; i < 8; i ++){
for (int j = 0; j <8 ; j++){
board[i][j] = other.board[i][j];
}
}
}