What is the error message?
Edit:
In your operator*, you are trying to return a vector, when it expects a Matrix. Make the return type be Vector.
[Matrix]*[Vector] = Vector.
Oh, it also sounds like you're having a dependency issue... I think I see issue (vector needs to know what a matrix is, matrix needs to know what a vector is), but it's hard to formulate what the exact correct code is in my head.
If the only reason that "Matrix.h" needs to be #included in Vector's header file is for the operator, then declare it like this instead:
1 2 3 4 5 6
|
// no #include "Matrix.h"
class Matrix;
class Vector {
friend Vector operator*(const Matrix& matrix, const Vector& vector);
};
| |
And then in the implementation file, you can #include "Matrix.h"
Basically, you use a reference there because you need to avoid the situation where the Vector needs to know the full definition of a Matrix before it can be created if the Matrix also needs to know the full definition of a Vector.