I keep getting an undesired value in this code. I've tried several methods, but none are giving me the correct answer. The out put is always zero, when in this case it should be 10!!
Why does it seem that the assignment operator is the harder operator to overload? Maybe it's just my luck, but I seem to always run into issues whenever I work with it. I hardly ever experience errors when overloading any of the other operators.
The way you have implemented operator= doesn't modify the object on the LHS. Normally operator= modifies the object on the LHS and returns a reference to that object.
I get this error: cannot convert 'this' pointer from 'const quantity<T,_b>' to 'quantity<T,_b> &'
I get the feeling that I need to reference the object using this, as Peter87 said, but as you can see I'm not good at all with operator functions, and I truthfully can't seem to figure out how to do it using the 'this' pointer.