Refactoring

This commit is contained in:
Данил
2025-07-31 14:24:13 +07:00
parent c1c5ffd7af
commit 2c68a258d2
2 changed files with 25 additions and 22 deletions
+24
View File
@@ -1,2 +1,26 @@
# Delegate
That library implement delegate for C++.
--------Exemple-------
#include <iostream>
#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<int> delegate;
A a;
delegate.bind(&a, &A::Foo1);
delegate.bind(&a, &A::Foo2);
delegate.unbind(&a, &A::Foo1);
delegate.Call(321);
return 0;
}
-21
View File
@@ -1,21 +0,0 @@
#include <iostream>
#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<int> delegate;
A a;
delegate.bind(&a, &A::Foo1);
delegate.bind(&a, &A::Foo2);
delegate.unbind(&a, &A::Foo1);
delegate.Call(321);
return 0;
}