O'Reilly logo

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design by Dmitri Nesteruk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Dmitri Nesteruk 2018

Dmitri Nesteruk, Design Patterns in Modern C++, https://doi.org/10.1007/978-1-4842-3603-1_21

21. State

Dmitri Nesteruk

(1)St. Petersburg, Russia

I must confess: my behavior is governed by my state. If I didn’t get enough sleep, I’m going to be a bit tired. If I had a drink, I wouldn’t get behind the wheel. All of these are states and they govern my behavior: how I feel, and what I can and cannot do.

I can, of course, transition from one state to another. I can go get a coffee, and this will take me from sleepy to alert (I hope!). So we can think of coffee as a trigger that causes a transition of yours truly from sleepy to alert. Here, let me clumsily illustrate it for you:

1           coffee2   sleepy --------> alert

So, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required