return * newarray[]; doesn't mean anything in C++.
Your assignment is to return a matrix, so you should return a matrix.
It's easy: begin by creating a second matrix, then copy the content, and finally return it.
1 2 3 4 5 6 7 8 9 10 11
matrix matrix::clone()
{
// create a new matrix object with the correct dimensions
matrix cloned_matrix(rows,columns);
// copy the content
/* ... */
// return the copy
return cloned_matrix;
}
By the way, why are you allocating size pointers ?
You should either allocate size doubles or rows pointers.
Also, thank you toum for the help. I was just trying random things to fix it by the time I posted this, so I'm glad you were able to understand what I was trying to do.