-
Book Overview & Buying
-
Table Of Contents
Learning C++ Functional Programming
By :
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.
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...
Change the font size
Change margin width
Change background colour