Download MetaTrader 5

Setting member variables in MQL5

To add comments, please log in or register
Sandreal
9
Sandreal  

Hello everybody,

I'm new in Mql5 and have a question about setting member variables. I want to do something like this:

#include <.../ABC.mqh>

class XYZ
{
private:
   ABC *test;
public:
   XYZ(ABC *test_new);
}

XYZ::XYZ(ABC *test_new)
{
   test = test_new;
}

The problem is that when I try to compile it seems that I only can use references as function arguments. Why can I only use pointers and not just objects as member variables?

Greetings

Sandreal

Documentation on MQL5: Checkup / Point
Documentation on MQL5: Checkup / Point
  • www.mql5.com
Checkup / Point - Documentation on MQL5
Andriy Moraru
1261
Andriy Moraru  
As far as I know, MQL5 doesn't offer work with pointers at all.
Sandreal
9
Sandreal  

There definitely are pointers ;)

Does anybody know how to deal with setting member variables of another class included from another mqh file by constructors or other methods?

Sandreal
9
Sandreal  
Ok, I probably didn't describe my problem good enough. But fortunately I got it. This helped a lot: https://www.mql5.com/en/forum/9095
MQL5 should permit circular class dependency
MQL5 should permit circular class dependency
  • www.mql5.com
I must admit it takes a lot of time to me to avoid circular class dependency when designing classes structure.
To add comments, please log in or register