class class2
{
int **matrix;
int nrow, ncol;
public:
void makeSomething();
};
I'd like that the two matrix pointers should be the same. In other words, I'd like to dynamically allocate matrix in either class2 or class1 instances and have the same matrix in both of them.
For example, think class1 as a window and class2 as a dialog. Now the dialog should open a file which stores the matrix data. But the class2's matrix (which is read from a file) whould be then used by the class1 object.
I thought it could be useful the reference (&) type but I don't know how to use it in this case..