Alexey Navoykov: I suggest not to argue, but just believe me that it is a mistake.
This verb is weakly applicable in a technical forum. Tried C++.
class A { };
class B : public A { };
A* a = new B;
B* b= dynamic_cast<B*>(a); // cannot dynamic_cast ‘a’ (of type ‘class A*’) to type ‘class B*’ (source type is not polymorphic)
B* b1= a; // invalid conversion from ‘A*’ to ‘B*’ [-fpermissive]
None of the options worked. The reasons are not clear.
If you make them interchangeable, then they are both just unnecessary.
In C++, this is possible:
I suggested the simplest variant which could be implemented tomorrow (not in 10 years) and would have an external resemblance to C++ (otherwise why change anything at all). Moreover, if operator*() is not and will not be implemented (there was information about it on the forum), it is unclear why operator->() would be suddenly implemented (they are of the same order).
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Why hasn't MQL fixed the bug that a base class is implicitly cast to a derived class? Not even a compiler warning!
It must be because of this correct construct
was not taken into account.
Probably because of this correct design
has failed to take yours into account.
It is exactly the same incorrect construction.
If there is a derived class object behind a pointer to a base class, that's a great construction.
If there is a derived class object behind the pointer to the base class, this is a great design.
I suggest not to argue, but just believe me that it is a mistake.
This verb is weakly applicable in a technical forum. Tried C++.
None of the options worked. The reasons are not clear.
If you make them interchangeable, then they are both just unnecessary.
In C++, this is possible:
I suggested the simplest variant which could be implemented tomorrow (not in 10 years) and would have an external resemblance to C++ (otherwise why change anything at all). Moreover, if operator*() is not and will not be implemented (there was information about it on the forum), it is unclear why operator->() would be suddenly implemented (they are of the same order).
Why hasn't MQL fixed the bug that a base class is implicitly cast to a derived class? Not even a compiler warning!
Are you waiting for a compilation error? There shouldn't be one, because in this case it's dynamic_cast
See above, fxsaber provided the C++ code.
compiled by
compiled by