Refactoring the imperative class to become a functional class

Indeed, the preceding Customer class can work well, and we have successfully invoked its methods. However, the class can still be tweaked by transforming it into a functional class. As we can see in the preceding code, we can implement a pure function, first-class function, higher-order function, and memoization to it to make it become functional. So, in this section, we will refactor the Customer class to become a functional class and use the knowledge we have from the previous chapters. In the upcoming section, we will implement the functional method that we have discussed in the previous chapter, which is the first-class function.

Get Learning C++ Functional Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.