45 lines
1.5 KiB
MQL5
45 lines
1.5 KiB
MQL5
//+------------------------------------------------------------------+
| |||
//| Repro.mq5 |
| |||
//| Copyright 2026, Niquel Mendoza |
| |||
//| https://www.mql5.com |
| |||
//+------------------------------------------------------------------+
| |||
#property copyright "Copyright 2026, Niquel Mendoza"
| |||
#property link "https://www.mql5.com"
| |||
#property version "1.00"
| |||
#property strict
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| |
| |||
//+------------------------------------------------------------------+
| |||
typedef string(*FormatFunc)(double value, int8_t decimals);
| |||
string DefaultFormat(double value, int8_t decimals)
| |||
{
| |||
return DoubleToString(value, decimals);
| |||
}
| |||
class CValue
| |||
{
| |||
public:
| |||
CValue(void) {}
| |||
~CValue(void) {}
| |||
FormatFunc m_func;
| |||
void Set(FormatFunc func_txt)
| |||
{
| |||
m_func = func_txt == NULL ? DefaultFormat : func_txt;
| |||
}
| |||
};
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| Script program start function |
| |||
//+------------------------------------------------------------------+
| |||
void OnStart()
| |||
{
| |||
//---
| |||
CValue v;
| |||
v.Set(DefaultFormat);
| |||
Print(v.m_func(10.0, 1));
| |||
}
| |||
//+------------------------------------------------------------------+
| |||
/*
| |||
Repro.mq5
| |||
Internal compiler error
| |||
*/
|