Download MetaTrader 5

Setting member variables in MQL5

To add comments, please log in or register
Write your articles using our editor. It is convenient!
Sandreal
9
Sandreal 2012.12.07 21:45 

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
Andrei Moraru
1157
Andrei Moraru 2012.12.07 23:47  
As far as I know, MQL5 doesn't offer work with pointers at all.
Sandreal
9
Sandreal 2012.12.09 14:23  

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 2012.12.13 19:22  
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