Errors, bugs, questions - page 1615
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
Compilation error:
Here are a couple more mistakes:
And there's also something wrong with the pointer conversion.
The following code does not compile:
although the conversion is explicit here. Everything works in C++.
And there's also something messed up about bringing in the signposts.
It's right, the compiler is fighting.
Go read about dynamic_cast, static_cast and reinterpret_cast and when to use them correctly and when not.
C++ converts this code to reinterpret_cast and MQL to dynamic_cast. And as far as I understand, this is exactly the case when compiler can find dynamiccast error during compilation.
reinterpret_cast is illegitimate in this case, so the fact that this code compiles in C++ is not an argument.
C++ converts this code to reinterpret_cast and MQL to dynamic_cast. And as far as I understand, this is exactly the case when the compiler can find a dynamiccast error during compilation.
Reinterpret_cast is illegitimate in this case, so the fact that this code compiles in C++ is not an argument.
Wait, why do you mix things up? What does dynamic cast have to do with it? The compiler's tasks do not include playing Sherlock Holmes and looking for something in the program logic. It only performs a formal check of compliance with the language standard, nothing more. And everything is correct from the viewpoint of the standard.
If you had looked carefully at my sample, you would have seen that the problem was related to protected. If you change it to public, everything is ok. The object itself is not changed because of this. That is, the MQL compiler just has an unnecessary restriction, that's all.
So don't speculate and look for a secret meaning where there is none, which is just a trivial compiler error.