#include <iostream>
#include <functional>
using namespace std;
class Button
{
private:
function<void()> f_m;
public:
Button(function<void()> f) : f_m(f) {}
~Button(){}
void operator() () { f_m(); }
};
class Game_Events
{
public:
Button* button;
Game_Events()
{
button = new Button([this]()->void{this->Close(); });
}
~Game_Events(){}
void Close(){ cout<<"Boum"<<endl;} //I need to pass this function for call it on the other side
};
int main() {
Game_Events e;
(*e.button)();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBCdXR0b24KewogICBwcml2YXRlOgogICAgICAgZnVuY3Rpb248dm9pZCgpPiBmX207CiAgIHB1YmxpYzoKICAgICAgIEJ1dHRvbihmdW5jdGlvbjx2b2lkKCk+IGYpIDogZl9tKGYpIHt9CiAgICAgICB+QnV0dG9uKCl7fQogICAgICAgdm9pZCBvcGVyYXRvcigpICgpIHsgZl9tKCk7IH0KCn07CgpjbGFzcyBHYW1lX0V2ZW50cwp7CiAgICBwdWJsaWM6CiAgICAgICAgQnV0dG9uKiBidXR0b247IAogICAgICAgIEdhbWVfRXZlbnRzKCkKICAgICAgICB7CiAgICAgICAgICAgIGJ1dHRvbiA9IG5ldyBCdXR0b24oW3RoaXNdKCktPnZvaWR7dGhpcy0+Q2xvc2UoKTsgfSk7CiAgICAgICAgfQogICAgICAgIH5HYW1lX0V2ZW50cygpe30KICAgICAgICB2b2lkIENsb3NlKCl7IGNvdXQ8PCJCb3VtIjw8ZW5kbDt9IC8vSSBuZWVkIHRvIHBhc3MgdGhpcyBmdW5jdGlvbiBmb3IgY2FsbCBpdCBvbiB0aGUgb3RoZXIgc2lkZQp9OwoKaW50IG1haW4oKSB7CglHYW1lX0V2ZW50cyBlOyAKCSgqZS5idXR0b24pKCk7IAoJCglyZXR1cm4gMDsKfQ==