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
looked at the results of my battle with OOP-style code - hmmm... excellent! ))))
I have a question, but in my code, well, three times exactly, I use a construction like:
calls all in privat methods, but is there a "Jedi method ?" to get away in the source code from CheckPointer(m_order)==POINTER_INVALID
I am asking about some get / set
no special problems, but so to speak a whim, or while the thirst for knowledge of OOP methods in C++ has not yet abated
If the question is "many letters", then !CheckPointer(mPtr), and if the function call, you initialize all pointers to NULL in the constructor and compare to it in the code, not forgetting when deleting ptr; ptr=NULL;
looked at the results of my battle with OOP-style code - hmmm... excellent! ))))
I have a question, but in my code, well, three times exactly, I use a construction like:
calls all in privat methods, but is there a "Jedi method ?" to get away in the source code from CheckPointer(m_order)==POINTER_INVALID
I am asking about some get / set
no special problems, but so to speak a whim, or while the thirst for knowledge of OOP methods in C++ has not yet abated
Igor, look at this example, I think that's what you're asking.
If the question is "many letters", then !CheckPointer(mPtr), and if in a function call, you initialise all pointers to NULL in the constructor and compare to it in the code, not forgetting when deleting ptr; ptr=NULL;
Well and this, for sugar:
No special problems, but so to say a whim, or while the thirst for learning OOP methods in C++ hasn't died down yet.
I strongly recommend that you initialize all the fields of the class with default values in the constructor. The point is that if you want to do this:
void foo(){ CClass someClass; someClass.DoSomething(); }
nobody will initialize the fields of your class and there will be rubbish values.
And this, for sugar:
No, I've almost given up on definitions, I just don't want to wrap anything, as I wrote a couple of weeks ago - I want to see pure OOP-style code for now, evaluate flexibility and possibilities
HH: I just wrapped descendants in define at creation, not to write the same initialization on 3 lines, it's easier to add methods later, i.e. in the source code on one line so far
Igor, take a look at this example, I think that's what you're asking.
no, i mean the equivalent in c# - operator ?? ( null-join operator ), something similar in logic I want to see in C++ style
UPD:
I highly recommend initialising all fields of a class with default values in the constructor. The point is that if you want to do this:
If you're asking for a macro, no one will initialise the fields of your class and there will be rubbish values.
that's what I did, constructor with initializing anything and everything in the base class, descendants initialize the base class:
that's exactly what I wrapped it in a macro, so I wouldn't forget to initialize properly ))))
No, I've almost given up on definitions, I just don't want to wrap anything, as I wrote a couple of weeks ago - I want to see pure OOP-style code for now, evaluate flexibility and possibilities
ZS: only wrapped descendants in define at creation, not to write the same initialization on 3 lines, it's easier to add methods later, i.e. in the source code on one line for now
no, i mean the equivalent in c# - operator ?? ( null-join operator ), I want to see something similar in logic in C++ style
Your refusal of the preprocessor is in vain. Along with templates they are the most powerful tools. There seems to be no analogue of the ?? operator. C++ is more hardcore in this respect.
I am still in a battle for pure OOP style, I want to learn all the OOP techniques, while there is an asset on the forum ;)
I'm up to speed on the preprocessor, but ... I think I shouldn't abuse it, at least, not my style, I may screw up, and I certainly won't be able to read code with multiple macrosubstitutions, and how to look for bugs... well, it's easier to rewrite - so, not necessary yet
templates... Well, I don't like what the developers offer in SB, I've looked through them all, it's hard to say for what purpose they were included in SB, maybe their time has not come yet
about C++ templates porting to MQL - it's time, as discussion showed, that in most cases C++ templates require fine-tuning for MQL - it's easier to go back to .dll and not to bother MQL ))))
I am still in a battle for pure OOP style, I want to learn all the OOP techniques, while there is an asset on the forum ;)
I'm up to speed on the preprocessor, but ... I think I shouldn't abuse it, at least, not my style, I may screw up, and I certainly won't be able to read code with multiple macrosubstitutions, and how to look for bugs... well, it's easier to rewrite - so, not necessary yet
templates... Well, I don't like what the developers offer in SB, I've looked through them all, it's hard to say for what purpose they were included in SB, maybe their time has not come yet
about C++ templates porting to MQL - it's time, as discussion showed, that in most cases C++ templates require fine-tuning for MQL - it's easier to go back to .dll and not to bother MQL ))))
You can write templates that way yourself.)))
Yup ))))
I have finished reading the help and skipped override, thank goodness everything is in macros, edits, well, exactly in one copy-paste
UPD:
no it isn't, got out for permission control itself, no need for public method!
And then there's this, for sugar:
I wanted to write what I used to have instead of
it was like this:
but remembered how to check macro substitutions in MQL
2019.09.16 22:57:42.837 tst (EURUSD,H1) a = 1
2019.09.16 22:57:42.837 tst (EURUSD,H1) POINTER_INVALID = 0
2019.09.16 22:57:42.837 tst (EURUSD,H1) NULL = 0
and if memory serves me correctly, at the beginning of the year it was possible to unprinter NULL into the log and get 0 there , now an error appears
I.e. the behavior NULL as if should not change in the future, but what is substituted there instead of NULL is not clear, probably if this situation is checked now, as writtenif(CheckPointer(m_order)==POINTER_INVALID)) ) it is so to say the correct code))