I have two class GameOfLife and Cell and i want to overload square braket for class GameOfLife."if g is a GameOfLife object, g[10][5] will return the Cell at row 10 and column 5. If there is no such Cells, then it will return a new Cell with position (-1000,- 1000)."
but if g[10][1000] and 1000>cols,then it returns different Cell exp (3,2)
How i do control the col ( [row][col] )??? Sorry for my english.
Code:vector<Cell> GameOfLife::operator [](const int row){ vector<Cell> rowCell; for(int i=0; i<cols; ++i) { if( isLive(row,i) ) rowCell.push_back( Cell(row,i) ); else rowCell.push_back( Cell(-1000,-1000) ); } return rowCell; }