examples/Observer/Button.cpp
/**
 * Stimulate a button press, and notify all observers that the button has
 * been clicked.
 */
Stimulate a button press, and notify all observers that the button has
been clicked.
Stimulate a button press and notify all observers that the button has been clicked .
void
Button::click()
{
    notify(
        [=](ButtonObserver& o) { o.onClicked(*this); });
}
void Button :: click ( ) { notify ( [ = ] ( ButtonObserver & o ) { o . onClicked ( * this ) ; } ) ; }
Stimulate a button press, and notify all observers that the button has
 been clicked.
Stimulate a button press and notify all observers that the button has been clicked .
//here, we pass a lamda expression to the notify method that calls the //onClicked method for each observer, passing this button in as the //argument.