Returning reference to a member variable

 

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

 

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?
  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.         |
    //+------------------------------------------------------------------+
    




Reason: