Chapter 7
Working with Lambda Expressions
In This Chapter
Considering the problem that lambda expressions solve
Writing your first lambda expression
Using lambda expressions in real-world programming
The previous chapters in this book focus on the Unified Modeling Language (UML) and how you use it to better model applications. Chapter 6 moves on to design patterns, which actually help you implement a model. This chapter takes the process one step further by looking at lambda expressions — an elegant method of turning a model into a math expression. Let’s say that you need to calculate the number of widgets produced in an hour before you can print out the value. Adding the equation directly to the existing code might look bulky, but adding it as a separate function makes the code hard to read. Lambda expressions provide a middle ground where you can define the calculation in an easy-to-read manner without creating a separate function.
Get C++ All-in-One For Dummies, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.