Introduction to OOP: Chapter 16 : A Case Study : The STL [next] [previous] [audio] [real] [text]

Function Objects

In C++ even the function call operator (parenthesis operator) can be overloaded. Allows for creation of objects that can be used like functions.

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

Can be used to find the first value bigger than 3, for example.

Intro OOP, Chapter 16, Slide 9