This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: x = e3; cout << x << "\n"; cout << e1 << "\n"; cout << e2 << "\n"; cout << e3 << "\n"; cout << E(0) << "\n"; return 0; } In the last output statement, we created an invalid enumerator value and then output it. Operator overloading in C++ is very powerful but can be abused. It's quite possible to create a system of operators such that it is difficult to know what is going on with a particular piece of code. Some uses of overloaded operators, such as for array indexing with subscript checking, -> for smart pointers, or + - * / for doing arithmetic on complex numbers, can make sense, while other uses may not....
View Full Document
- Fall '08
- #include, cout cout cout, iostream.h