diff --git a/README.md b/README.md index 1fa7d69..1caad4f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # Delegate -That library implement delegate for C++. \ No newline at end of file +That library implement delegate for C++. + +--------Exemple------- + +#include + +#include "Delegate.h" + +class A +{ +public: + void Foo1(int var) { std::cout << "A::Foo1(" << var <<");\n"; } + void Foo2(int var) { std::cout << "A::Foo2(" << var <<");\n"; } +}; + +int main(int argc, char* argv[]) +{ + Delegate delegate; + A a; + delegate.bind(&a, &A::Foo1); + delegate.bind(&a, &A::Foo2); + delegate.unbind(&a, &A::Foo1); + delegate.Call(321); + return 0; +} diff --git a/exemple/main.cpp b/exemple/main.cpp deleted file mode 100644 index 80a63dc..0000000 --- a/exemple/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "Delegate.h" - -class A -{ -public: - void Foo1(int var) { std::cout << "A::Foo1(" << var <<");\n"; } - void Foo2(int var) { std::cout << "A::Foo2(" << var <<");\n"; } -}; - -int main(int argc, char* argv[]) -{ - Delegate delegate; - A a; - delegate.bind(&a, &A::Foo1); - delegate.bind(&a, &A::Foo2); - delegate.unbind(&a, &A::Foo1); - delegate.Call(321); - return 0; -}