I l @ ve RuBoard |
C++ is very good at giving you the tools to organize and use information in a way that's most natural to you. Operator overloading is one of the features that facilitates this. It allows you to define functions to be called when ordinary C++ operators are used on the classes you've defined. For example, you can use operator overloading to tell C++ how to combine two boxes ( a_box + b_box ). (This assumes that you have a definition of what it means to add two boxes and that it makes sense to do so.) In this chapter we will go step by step through the creation of a fixed-point class and all the operators for it. |
I l @ ve RuBoard |