Although all programmers familiar with the C++ computer programming language will unanimously agree that the language is a multi-paradigm language, not many are aware that it sufficiently supports writing programs in the functional style or logic style.
One of the tragic consequences of lack of this knowledge is that there are few computer programming lecturers in our universities who can teach functional programming. A typical programming lecturer (familiar with C++) assumes that to teach functional programming, one must learn a language specifically designed for functional programming (such as ML and Haskell) and very few are ever eager to learn a new language from scratch. This may explain why most of our universities donâ€™t have functional programming in their curriculum or if it is there, then it is an elective course that is rarely if ever taught.
In this paper, I highlight C++ languageâ€™s support for the functional programming style. I explore some functional programming concepts and illustrate how each can be accomplished in C++. It is my hope that this paper will bring back this beautiful paradigm into our universitiesâ€™ curricula. I also hope that those who use the other paradigms of C++ for example in software development will realize that they can also write most of the code using the functional style.