From the course: C++ Design Patterns: Behavioral

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Implementing the Chain of Responsibility pattern

Implementing the Chain of Responsibility pattern - C++ Tutorial

From the course: C++ Design Patterns: Behavioral

Implementing the Chain of Responsibility pattern

- [Instructor] Now that we've learned the basics of the chain of responsibility pattern. Let's take a look at a concrete example of what this pattern might look like in code. So I mentioned previously that the chain of responsibility pattern could be used to implement string validation. And that's the example we're going to be looking at here. More specifically, let's say that a user is trying to create an account for our application and we therefore have three strings we need to validate, right. The first one is the user's name. The second is their email address. And the third is their password. Each of these strings is going to have a different set of criteria, obviously that it's required to meet. So for the email address, for example. We're obviously going to need to make sure that what the user has entered is actually an email address. And for the password we'll need to make sure that it's the right length, that the…

Contents