oops, test.cpp was renamed! removing again.
This commit is contained in:
1 parent
1c9d5d0b25
commit
72be82ba05
1 file changed
-61
@@ -1,61 +0,0 @@
|
|||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#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<bool> sig;
|
|
||||||
sig.connect(&f,&Foo::Bar);
|
|
||||||
sig.connect(&f,&ParentFoo::Bar);
|
|
||||||
sig.connect(&somefunc);
|
|
||||||
sig();
|
|
||||||
|
|
||||||
signal<void,int> sigx;
|
|
||||||
sigx.connect(&anotherfunc);
|
|
||||||
sigx(12);
|
|
||||||
sigx(999);
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user