Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>operator operator type</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 operator                operator Type

 operator operator_symbol(parameters) {statements;}

    The operator keyword allows you to overload (i.e. customize the
    deifinition for your objects) the action of a given operator. The
    operators << and >> are already overloaded in C++. The only operators
    you cannot overload are:

                  ?:    .    ::    .*    ->*

   -------------------------------- Example ---------------------------------
        This example overloads the + operator to work on complex numbers.

       complex operator+ (complex conum1, complex conum2)
       {
          return complex(conum1.real+conum2.real, c1onum.imag+conum2.imag);
       }

See Also: class

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson