J
Jonathan Bartlett
Two problems:
1) Since you are passing by _reference_, that implies that any changes
to the object will affect the object being sent. Making a copy through
a copy constructor or a casting operator will violate that assumption.
That is why adding a const fixes it -- since you are guaranteed to not
be making any changes, everything should work just fine even when
operating on a copy.
2) Since you have both a copy constructor and a casting operator, there
is ambiguity as to which to use.
Jon
1) Since you are passing by _reference_, that implies that any changes
to the object will affect the object being sent. Making a copy through
a copy constructor or a casting operator will violate that assumption.
That is why adding a const fixes it -- since you are guaranteed to not
be making any changes, everything should work just fine even when
operating on a copy.
2) Since you have both a copy constructor and a casting operator, there
is ambiguity as to which to use.
Jon