31 lines
470 B
C++
Raw Normal View History

2014-08-03 19:52:23 +02:00
// Taken from https://developer.gnome.org/libsigc++-tutorial/stable/ch02.html
#include <iostream>
2020-02-01 23:06:01 +01:00
2016-07-09 11:21:54 +02:00
#include <sigc++/sigc++.h>
2014-08-03 19:52:23 +02:00
class AlienDetector
{
public:
2016-07-09 11:21:54 +02:00
AlienDetector() {}
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
void run() {}
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
sigc::signal<void> signal_detected;
2014-08-03 19:52:23 +02:00
};
void warn_people()
{
2016-07-09 11:21:54 +02:00
std::cout << "There are aliens in the carpark!" << std::endl;
2014-08-03 19:52:23 +02:00
}
int main()
{
2016-07-09 11:21:54 +02:00
AlienDetector mydetector;
mydetector.signal_detected.connect(sigc::ptr_fun(warn_people));
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
mydetector.run();
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
return 0;
2014-08-03 19:52:23 +02:00
}