2013-08-06 13:33:59 +04:00
|
|
|
// Taken from https://developer.gnome.org/libsigc++-tutorial/stable/ch02.html
|
|
|
|
|
|
|
|
#include <iostream>
|
2016-04-29 17:53:13 +03:00
|
|
|
#include <sigc++/sigc++.h>
|
2013-08-06 13:33:59 +04:00
|
|
|
|
|
|
|
class AlienDetector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AlienDetector() {}
|
|
|
|
|
|
|
|
void run() {}
|
|
|
|
|
|
|
|
sigc::signal<void> signal_detected;
|
|
|
|
};
|
|
|
|
|
|
|
|
void warn_people()
|
|
|
|
{
|
|
|
|
std::cout << "There are aliens in the carpark!" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
AlienDetector mydetector;
|
|
|
|
mydetector.signal_detected.connect( sigc::ptr_fun(warn_people) );
|
|
|
|
|
|
|
|
mydetector.run();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|