M
Marco Kunze
Hi,
I have the following problem:
I am trying to write a small Matrix-class:
class Matrix {
public:
Matrix(int r, int c);
Matrix(Matrix& mat);
Matrix operator* (Matrix mat);
};
Now, when I do this:
Matrix m4 = m1;
m4 = m1 * m1;
everything works fine. But if I try to shorten it to
Matrix m4 = m1 * m1;
then the compiler says:
Test.cpp: In function `int main(int, char**)':
Test.cpp:61: error: no matching function for call to
`Matrix::Matrix(Matrix)'
Matrix.h:17: error: candidates are: Matrix::Matrix(Matrix&)
It would be great if someone could tell me my mistake, I don't see
anything obvious
Thank you.
Marco
I have the following problem:
I am trying to write a small Matrix-class:
class Matrix {
public:
Matrix(int r, int c);
Matrix(Matrix& mat);
Matrix operator* (Matrix mat);
};
Now, when I do this:
Matrix m4 = m1;
m4 = m1 * m1;
everything works fine. But if I try to shorten it to
Matrix m4 = m1 * m1;
then the compiler says:
Test.cpp: In function `int main(int, char**)':
Test.cpp:61: error: no matching function for call to
`Matrix::Matrix(Matrix)'
Matrix.h:17: error: candidates are: Matrix::Matrix(Matrix&)
It would be great if someone could tell me my mistake, I don't see
anything obvious
Thank you.
Marco