Tuesday, September 9, 2008

Microsoft-TS Certification Exam 70-648

All of the bitwise 70-621 operators are binary, excepting complement, which is unary. It should be noted that these operators have a lower precedence than the arithmetic operators, so if ^ were to be overloaded for exponentiation, x ^ y + z may not work as intended. Of special mention are the shift operators, << and >>. These have been overloaded in the standard library for interaction 70-642 with streams. When overloading these operators to work with streams the rules below should be followed:

1. overload << and >> as friends (so that it can access the private variables with the stream be passed in by references
2. (input/output modifies the stream, and copying is not allowed)
3. the operator 70-648 should return a reference to the stream it receives (to allow chaining, cout << 3 << 4 << 5)

No comments: