0
Views
0
Downloads
0
Favorites
Test_v3
//+------------------------------------------------------------------+
//| test.mq5 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
#include <CDelegate.mqh>
void OnStart()
{
delegate(VOID,0) test1;
delegate(VOID,2)<int,double> test2;
delegate(OUT,0)<int> test3;
delegate(OUT,2)<double,int,double> test4;
test1+=Test1_1;
test1+=Test1_2;
test1+=Test1_3;
test2+=Test2_1;
test2+=Test2_2;
test2+=Test2_3;
test3+=Test3_1;
test3+=Test3_2;
test3+=Test3_3;
test4+=Test4_1;
test4+=Test4_2;
test4+=Test4_3;
Print(test1.Find(Test1_2));
test1-=Test1_2;
Print(test1.Find(Test1_2));
test1.Invoke();
test2.Invoke(3,5.0);
Print(test3.Invoke());
Print(test4.Invoke(2,2.5));
}
//+------------------------------------------------------------------+
void Test1_1(){Print(__FUNCTION__);}
void Test1_2(){Print(__FUNCTION__);}
void Test1_3(){Print(__FUNCTION__);}
void Test2_1(int a,double b){Print(__FUNCTION__+" sum="+string(a+b));}
void Test2_2(int a,double b){Print(__FUNCTION__+" sum="+string(a+b));}
void Test2_3(int a,double b){Print(__FUNCTION__+" sum="+string(a+b));}
int Test3_1(){Print(__FUNCTION__);return 1;}
int Test3_2(){Print(__FUNCTION__);return 2;}
int Test3_3(){Print(__FUNCTION__);return 3;}
double Test4_1(int a,double b){Print(__FUNCTION__+" sum="+string(a+b));return a+b;}
double Test4_2(int a,double b){Print(__FUNCTION__+" sum="+string(a+b));return a+b;}
double Test4_3(int a,double b){Print(__FUNCTION__+" sum="+string(a+b));return a+b;}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---