Custom operators

You declare your own operators when you want to define a custom behavior no other standard operator is designed for. Think of exponentiation for example. You could overload the multiplication operator since exponentiation means repeated multiplication, but it would be confusing: Operators are designed to do only one type of operation, and you use the same operator to do two different things in this case.

So you'll define your own exponentiation operator, first only for a certain type and

then extend it by making it generic. Before doing that, you need to know a little bit of theory about operator types. Time to dive in! :]

results matching ""

    No results matching ""