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
Use static constructors (another benefit is to give meaningful names to constructors, like the example)
I have been thinking about this while I read Alain's link. Somewhere there they mentioned this, too, it's called it a builder method (or pattern) right?
Let's say I go and combine that with the user error scheme above, then I'd get something like this:
This combines three proposals:
Comments?
I have been thinking about this while I read Alain's link. Somewhere there they mentioned this, too, it's called it a builder method (or pattern) right?
Let's say I go and combine that with the user error scheme above, then I'd get something like this:
This combines three proposals:
Comments?
*-it is based on kind of factory method, what you use is the thin version for only the factory, which is satisfying for most cases
I have been thinking about this while I read Alain's link. Somewhere there they mentioned this, too, it's called it a builder method (or pattern) right?
Let's say I go and combine that with the user error scheme above, then I'd get something like this:
This combines three proposals:
Comments?
This is a python design pattern applied to MQL and it doesn't make sense. In general you only want to use dynamic objects when you need to add them to collections or want to completely destroy them for some reason (like Expert reinitialization). When you use the Error system you are only setting a hidden global flag. You might as well just have a global int variable which you check. If the goal of the objects construction is to return a NULL pointer in the event of an error then just set the error flag and delete the object -- instead of the rube-goldberg like use of other languages' design patterns.
@nicholi shen thank you, this looks very interesting, I'll study/explore the solution later.
So today I came across this code sequence in OnInit of some EA:
I mention it here since it seems to fit my topic.
It looks like the class instance requires an additional initialization, 1. constructor, 2. init call. This could hardly be considered a good practice, right?
I haven't delved much into the MQL classes so far. Is this standard behavior?