I have a C++ class that has a function that takes in a 2D array from another variable of the same class so that this particular instance of the array can access the other variable. The variable in question is a 2D array. Given the code below how would you implement the accessor function to get the private 2D array variable. My intention is for the accessor to return the 2d array but I cannot figure out which return type to use. int[][], int**, int* and int doesn't work.
class MyClass{
public:
// gets private x variable from another MyClass variable
void proccessVar(const MyClass& aVar){
// get and process the 2D array by calling getX()
// int temp[10][10];
// temp = aVar.getX();
// proccess temp 2D array
}
// Return 2D array x
int** getX(){
return x;
}
private:
int x[10][10] = {{0},{0}}; // initialized value
}