Hello,

I was wondering, can someone please help me with a problem I am having?

I have several classes, similar to vectors and matrices, that need to be able to mulitply themselves in the following way.

Vector vec1;

Vector vec2;

Matrix mat1;

vec2 = vec1 * mat1 * vec2; (1)

Btw this is just a sample of what I want to do, I haven't worried about transpose and sizes etc. To implement this, I have written the classes to take references and return objects. For example,

Vector Matrix:perator* (const Vector&);

But as you can imagine, I can't do the sum (1) above because the return object from the first multiplication is not assigned, so a reference can't be passed to the second multiplication operation.

Is there a way to be able to do sum (1) without passing in an object rather than a reference?

Thanks for your help in advance.