You can 'hand over' a variable by reference:
void func( double &var ){..}
But I think you know it.
tomtester: is it possible to return a reference in MQL4?
- Return Operator - MQL4 Documentation What can be returned: simple types, simple structures, object pointers.
//+------------------------------------------------------------------+ //| Mql4 is like C++ except: no typedefs or namespaces, no pointers | //| to POD, no operator(), operator*, or operator->, no implicit | //| conversions (operator bool), no templated classes, no Koenig | //| lookup, can't return references, no dynamic cast, no exceptions, | //| no class friends, no multiple inheritance. Can't use template | //| <class X...> must be template <typename x...>. f(const T&){} | //| f(123) or f( f2() ) doesn't compile (Build 765.) Must have a | //| actual variable. Structures must be passed by reference. | //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dear MQL4 Users,
is it possible to return a reference in MQL4? E.g. to a member variable. In C++ this is common practice, but I get an ugly "reference cannot used" error from the mql4 compiler.
Thanks in advance,
Tom