## 26.5.1 Function Objects (cont.)

- Add attributes to extend functionality:

  >     class SalaryComparator
  >     {
  >     public:
  >        SalaryComparator(bool a) : ascending(a) {}

  >        bool operator()(const Employee& a, const Employee& b)
  >        {
  >           if (ascending)
  >              return a.get_salary() < b.get_salary();
  >           else
  >              return a.get_salary() > b.get_salary();
  >        }

  >     private:
  >        bool ascending;
  >     }

prev |top |next