rename test.cpp -> example.cpp

This commit is contained in:
swaits committed 2010-10-04 16:00:23 -07:00
1 parent 0b396aede9
commit 13d87f7ed3
1 file changed
+62
View File
@@ -0,0 +1,62 @@
#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);
}