class Foo { private: bool isFirst; bool isSecond; bool isThird; public: Foo() { isFirst = false; isSecond = false; isThird = true; }</p> <pre><code>void first(function&lt;void()&gt; printFirst) { while (!isThird); isThird = false; isSecond = false; printFirst(); // printFirst() outputs &quot;first&quot;. Do not change or remove this line. isFirst = true; } void second(function&lt;void()&gt; printSecond) { while(!isFirst); isFirst = false; isThird = false; // printSecond() outputs &quot;second&quot;. Do not change or remove this line. printSecond(); isSecond = true; } void third(function&lt;void()&gt; printThird) { while(!isSecond); isFirst = false; isSecond = false; // printThird() outputs &quot;third&quot;. Do not change or remove this line. printThird(); isThird = true; } </code></pre> <p>};