top of page

CPP coding
CPP: Decorator
The Decorator Pattern The Decorator is a Structural design pattern. It allows you to dynamically attach new behaviors or responsibilities to an object by placing it inside a special wrapper object that contains these new behaviors. The Problem It Solves Imagine you are writing a system for a coffee shop. You start with a base Coffee class. Then, customers want variations: Coffee with Milk, Coffee with Sugar, Coffee with Vanilla, Coffee with Milk AND Sugar... If you use standa
Ashok Kumar Kumawat
May 114 min read
CPP: Lambda function
What is a Lambda Function in C++? A lambda function (often just called a "lambda") is an anonymous function—a function without a name. Introduced in C++11, lambdas allow you to write quick, throwaway functions directly inline inside your code, exactly where you need them. They are incredibly useful when you need to pass a short snippet of code to another function, such as when using C++ Standard Library (STL) algorithms like std::sort, std::find_if, or std::for_each. The Synt
Ashok Kumar Kumawat
May 113 min read
bottom of page