I’m trying to understand operator overloading in C++, and can see the usefulness when used carefully on operators like + and []. I’m interested now in the overloading of (). Boost seems to use it with its statistical classes, and I can use them, but don’t really understand what I’m doing.
Can anyone provide a simple example of when overloading the () operator would be useful?
Thanks guys
Pete
A common use of overloading the operator() is for function objects or
functors. You can use objects of a class that defines the operator() and use as if it is a function as shown in example below: