Please help me understand how access to static elements of a class from methods of the same class is organized in MQL4.
self – does not work
SELF:: accessing static elements from class methods
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
marketeer
Is it okay that creating each new object will fill the shared static array with zeros?
eugene1
Thanks! It helped!
fxsaber
Add the following line below the class description
double ZigZacMA::CommonCoefs[NUMBER_OF_COMMON_COEFS];
eugene1
Excuse me. I will try to add a piece of code for illustration:
class M {
public:
static int MyProblem = 1;
private:
int printmyproblem() {
Print(M::myproblem); / / works
Print(self::myproblem); / / doesn't work
}
}
Here is an illustration of my question.
Are there no SELF directives at all?
c-4
This isn’t a telepathic club. Give the problem code. Access to static variables inside instances of a class is the same as access to any other variables inside the class.