Confused with function header
For an assignment, I've been given function headers and I have to write the actual functions to go along with the headers. About half of all of the functions in the program are supposed to be written by me and the rest are provided. The problem that arises is the provided functions are dependent on the functions you have to write and so while my functions work independently, the functions that depend on my functions don't work at all. I'm guessing this has something to do with me modifying the function headers... Let me provide an example.
For the header
I have to write a function that exchanges to rows (i and j) of a 2D vector (that's the implicit object in a class called Matrix). So my implicit object is called a Matrix, and I have two ints that tell me which two rows to exchange. What I don't get is how can I modify the "Matrix" if the function has a const; at the end. The void implies I cannot return anything and the const does not let me change the object.
void iej(const int&,const int&)const;
So basically my question is, is there any way to modify my object without changing the function header? If so could I get any starting points on what to do? Thanks.
Here's my code (with modified header)
The reason I don't want to change the function headers is because the other given functions don't work if I do (and I'm not allowed to modify those)...
//EXCHANGES ROW 'I' AND ROW 'J'
void Matrix :: iej(const int&i,const int&j)
assert((i <= (nRow()-1)) && (j <= (nRow()-1)));
//copy Row I to a temporary variable
//copy Row J to Row I
//copy temporary variable to Row J
for (int z=0; z < nCol(); z++)