I have a matrix class which there are matrix objects. I want to call .value(int,int) directly on the matrix objects and set the internal 2d vector to the value on the right side of the equal sign.

Here is what I want to do:

new_matrix.value(row,col) = 0;

Here is what I've tried:

int &Matrix::value(int row, int col)
{
    return this->mat[row][col];
}

Where mat is the internal 2d vector data.

Recommended Answers

All 3 Replies

I don't find any problem in the code

That's what someone else said. Which compiler are you using? I'm using bloodshed.

It should work in both dev and VC...anyworks from next time give your complete code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.