[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: A class definition example Up: More on Classes Previous: Abstract Classes

Redefining operators

If you need to redefine operators remember to redefine then consistently (if you redefine '+' don't forget '+=') and remember that you can't change precedence order. The default assignment operator does a simple copy of members, which might not be what you want.

Examples of redefining operators are in most books. Some things to remember when redefining assignment operators are


next up previous contents
Next: A class definition example Up: More on Classes Previous: Abstract Classes
Tim Love
2001-07-05