Raymond D. answered 10/02/15
Tutor
5
(2)
Retired, But Enjoy Passing on Math and Computer Knowledge
The address of (&) and the comma (,) operators cannot be overloaded. As was previously stated the assignment operator(=) is implicitly defined by the compiler if it hasn't been explicitly defined. The modulus operator (%) can be overloaded, but not as previously defined [N operator%(const N&, const N&);]. The prototype should be:
N operator%(const N&) const; since it is a binary operator and the value on the left of the operator is the calling instance and is implicitly passed into the function (within the function it is referenced as the "this pointer"). The const outside of the parentheses says that the value on the left of the operator will not be changed in this function. The value on the right of the operator is passed as the parameter, which also will not be changed in the function.
Leon W.
07/08/14