Accessor for a matrix

Hey guys,
i need an Accessor for my matrix(vector of vectors) and i think i need to use reference, but i don“t know how to do it.

exemple:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Matrix
{
private:
         int row;
         int col;
         vector<vector<int> > mymatrix;
public:
         Matrix(int _row, int _col):row(_row),col(_col){i build the matrix here};
         ~Matrix();

         vector<vector<int> > getMatrix() const {return mymatrix;} 
}

class BinPacking
{
private:
        vector<vector<int> > copyOfMatrix;
        Matrix matrix;
public:
        void copyMatrix() {copyOfMatrix = matrix.getMatrix();}
}



when i do that the value of getMatrix() is NULL. Why? How can i copy a matrix from a class to another?

thank you guys
Last edited on
Topic archived. No new replies allowed.