Introduction to OOP | Chapter 19: Container Classes : | next | previous | audio | real | text |
class printingObject { public: void operator () (int x) { cout << "value is " << x << endl; } }; printingObject printer; // create an instance of the function object for_each (aList.begin(), aList.end(), printer);The function for_each passes the object to element element in the collection.