From 1c9d5d0b257691fa06ec2358adb3c50f10bb4cd1 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 4 Oct 2010 16:13:14 -0700 Subject: [PATCH] test.cpp got left out of prior commit --- test.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 test.cpp diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..4873f3b --- /dev/null +++ b/test.cpp @@ -0,0 +1,61 @@ +#include +#include + +#include "signal.h" + +class ParentFoo +{ +public: + virtual bool Bar() + { + printf("ParentFoo::Bar!\n"); + return false; + } + + virtual ~ParentFoo() + { + // empty + } +}; + +class Foo: public ParentFoo +{ +public: + bool Bar() + { + printf("Foo::Bar!\n"); + return true; + } + + virtual ~Foo() + { + // empty + } +}; + +bool somefunc() +{ + printf("some func\n"); + return true; +} + +void anotherfunc(int x) +{ + printf("got %d\n",x); +} + +int main(int argc, char** argv) +{ + Foo f; + + signal sig; + sig.connect(&f,&Foo::Bar); + sig.connect(&f,&ParentFoo::Bar); + sig.connect(&somefunc); + sig(); + + signal sigx; + sigx.connect(&anotherfunc); + sigx(12); + sigx(999); +} \ No newline at end of file