Operator overloading question
Joseph Cassman
jc7919 at outlook.com
Sun Jan 20 22:19:45 PST 2013
Please refer to http://dpaste.dzfl.pl/edit/b73ef2cd
The code is contrived but is trying to focus on overloading the
"+" and "*" operators for a struct.
Here is the output.
/home/c215/c527.d(36): Error: incompatible types for ((x) + (y)):
'Arithmetic!(int)' and 'Arithmetic!(int)'
/home/c215/c527.d(37): Error: 'x' is not of arithmetic type, it
is a Arithmetic!(int)
/home/c215/c527.d(37): Error: 'y' is not of arithmetic type, it
is a Arithmetic!(int)
I am trying to understand why there are errors at all.
Also why the error for line 36 is different from the error for
line 37.
Thanks
Joseph
More information about the Digitalmars-d-learn
mailing list