[Solved] A function object:


A function object is an instance of a class that defines the parenthesis operator as a member function. When a function object is used as a function, the parenthesis operator is invoked whenever the function is called. Consider the following class definition:

class biggerThanThree 
 {
   public:
   bool operator () (int val)
   { return val > 3; }
};

If we create an instance of class biggerThanThree, every time we reference this object using the function call syntax, the parenthesis operator member function is invoked.


Reference:

  1. http://www.cplusplus.com/reference/functional/binary_function/
  2. https://msdn.microsoft.com/en-in/library/aa985932.aspx

solved A function object: