Hi all! I am following the C++ operator overloading guidelines (*) in

order to create a simple matrix class, with all standard operators

(sum, difference, and so on). Everything worked until I tried to use

the assignment operator! As with the guideline, I started implementing

the compound assignments, then I use them exactly as in the guide to

create an operator (first operator=*, and next using it for defining

operator*).

What I am battling with this compilation error:

error: no match for 'operator=' in 'p = #'obj_type_ref' not supported

by dump_expr#<expression error>(((matrix&)(& o)))'

note: candidates are: virtual matrix& matrix:

perator=(matrix&)

within this simple assignment:

matrix p, a, o;

// Do something with "a" and "o", then:

p = a * o; // <==== BAM! Compilation error!

My class "matrix" defines all the operators I need as in the guideline:

class matrix {

// ...

virtual matrix& operator=(matrix& src);

virtual matrix& operator+=(matrix& src);

virtual matrix& operator-=(matrix& src);

virtual matrix& operator*=(double src);

virtual matrix& operator*=(matrix& src);

virtual matrix operator+(matrix& src);

virtual matrix operator-(matrix& src);

virtual matrix operator*(double src);

virtual matrix operator*(matrix& src);

virtual bool operator==(matrix& src);

virtual bool operator!=(matrix& src);

// ...

};

However, if I change a little the assignment using the compound ones,

it works perfectly:

matrix p, a, o;

// Do something with "a" and "o", then:

p = a;

p *= o;

// It works like a charm

I am sorry I can't understand the error, I am still learning! Can you

point me in the right direction?

Thanks & cheers!

(*) URL:

http://www.cs.caltech.edu/courses/cs...e/cpp-ops.html