Returning reference to a member variable

Back to topics list To post a new topic, please log in or register
tomtester 2015.02.02 23:37

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,

gooly 2015.02.03 00:17 #

You can 'hand over' a variable by reference:

void func( double &var ){..}

But I think you know it.

WHRoeder 2015.02.03 03:32 #
tomtester: is it possible to return a reference in MQL4?
  1. Return Operator - MQL4 Documentation What can be returned: simple types, simple structures, object pointers.
  2. //+------------------------------------------------------------------+
    //| 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.         |

Back to topics list  

To add comments, please log in or register