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
Here is the example. and the output.
Actually can do something like that.
He don't need know the concrete object since it has the update() method. so can use some other base class, or even the CBase if updade() is virtual, if not virtual need derive childs from another class/interface which has the update() method.
In the initial question childs was derived from CBase
So he can do that also. and don't need the interface
Unnecessary. Update() is virtual; just call it.
Unnecessary. Update() is virtual; just call it.
That is a surprise as I use this approach a lot and have not had such issues. Were you by nay chance creating a new object on every tick?
That could consume a lot of memory - I am sure you know already, but it is better to instantiate once and re-use.
Also, what is it you are planning to do with this approach? Seems very involved and intricate
That is a surprise as I use this approach a lot and have not had such issues. Were you by nay chance creating a new object on every tick?
- The object were create once on child. But multiple child. But that's for now. Since this library meant to be used on EA, later on will be execute on every tick. I'm aware of that. Array also does much impact on memory
Also, what is it you are planning to do with this approach? Seems very involved and intricate
- My EA, scripts, indicator share the same library. Since it's the same library, previously all the code is store in include\main.mqh. And has thousands line of code in it. But it give me headache to find what I need. So I decide to refactor/migrate all code into separate files. The class still the same. Some code are easy to handle because there's no dependencies. But there are a few class with thousand of line of codes that I want to separate into multiple files small class.
After doing that. Since a big class is split into multiple small class.
Every times the base update is called to be updated, the derived class is update as well.
Since there's a data that required on derived class from protected base.
So every time data on protected base is update, all the child class need to update as well.
Here is the example. and the output.
Hi Samuel Manoel De Souza . Thank you.. The proposed method work..
At first I encounter the class is inaccessible. But here explained why. Because of I'm extending protected. After changing it to public all back on track.
After refactor all the code, and compiled without any error. But I had stack overflow error when the script is applied to the chart.
Anyone know how to see the log of this runtime error?