Actually I just want to understand why the author uses const here:
void CRSIAverage::SetRSIPointers(const CRSIIndividual &rsi_objects[]) { int total = ArraySize(rsi_objects); ArrayResize(rsi_indicators, total); for (int i=0; i<total; i++) rsi_indicators[i] = (CRSIIndividual*)GetPointer(rsi_objects[i]); }
It's just "good manners" and the const does not affect anything? Or is there some sence here that I don't know?
Code taken from this article.
![Complex indicators made easy using objects Complex indicators made easy using objects](https://c.mql5.com/36/0/complex-indicators-made-easy-using.jpg)
- www.mql5.com
In order to prevent changing of a parameter passed by reference, use the const modifier
Everything is clear here:
But I can change the object in this way:
That is, the const modifier protects against accidental change. But if you wish, you can change the passed object. Do I understand correctly?
Actually I just want to understand why the author uses const here:
It's just "good manners" and the const does not affect anything? Or is there some sence here that I don't know?
Code taken from this article.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In order to prevent changing of a parameter passed by reference, use the const modifier
Everything is clear here:
But I can change the object in this way:
That is, the const modifier protects against accidental change. But if you wish, you can change the passed object. Do I understand correctly?