algotrader01:
Hello,
I want to declare static arrays to be used in different classes, so they should be initialized only once. I also want to directly assign values to the arrays. Putting these arrays into the public part of the class, I get an '=' - illegal assignment use error. Putting them into the Initialize() function, however, works....
You need to initialize the static variables on the global scope.
class Test { private: public: static double A[]; static double B[]; void Initialize(); Test(); ~Test(); }; double Test::A[] = {0, 10, 10, 10, 10, 20, 20, 20}; double Test::B[] = {0, 60, 60, 60, 60, 60, 60, 60};
Cool, that is doing the job. Haven't seen that before. Thank you Alain!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I want to declare static arrays to be used in different classes, so they should be initialized only once. I also want to directly assign values to the arrays. Putting these arrays into the public part of the class, I get an '=' - illegal assignment use error. Putting them into the Initialize() function, however, works....