As we discussed in Chapter 2, Manipulating Functions in Functional Programming, we can rewrite the function to be a first-class function, which means we can pass a function to another function. We will simplify the definition of all the four methods we have in the Step01 code, then we will call the function by passing it to another method named GetActiveCustomerByFunctionField(). We will also create a new method named GetActiveCustomerByField() to select the correct method we should run. The definition of the Customer class is now like the following Customer.h code:
/* Customer.h - Step02 */ #ifndef __CUSTOMER_H__ #define __CUSTOMER_H__ #include <string> #include <vector> #include <functional> class Customer ...