Errors, bugs, questions - page 1816
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
I've encountered (in my opinion) incorrect behaviour of object pointers.
It looks like an MQL error.
You have the error. How do you imagine assigning an empty parent to a descendant?
It looks like an MQL error.
You have the error. How do you imagine assigning an empty parent to a descendant?
Exactly the same as non-empty. In baseObj1 there is a pointer to an object of descendant class. If you remove delete(obj1), the assignment in the last line doesn't cause any problems - the pointer types match. I think the assignment must go the same way if the object the pointer refers to is deleted. And there must be no "Invalid pointer access" error for there is no attempt to access a deleted object.
Here is this part of your code.
Apparently, it's checking if the type of object referenced by baseObj1 matches the type of pointer obj2. There are two possibilities here:
1) The pointer itself can be a complex structure that contains the type of the object
2) We need to refer to the object to find out its type.
This seems to be case #2, and we'll have to live with it. Thanks for the leading questions )
Kaspersky has been yelling at the terminal trying to update for the last week.
This part of your code
Same as here.
class B : public A {};
class C : public B {};
void OnStart()
{
B *b = new B;
delete b;
B *c = b;
b = new C;
A *a = c;
Print( a, ":", b, ":", c );
}
Just like here.
class B : public A {};
void OnStart()
{
B *b1 = new B;
A *a = b1;
delete b1;
B *b2 = b1;
b1 = new B; //уже другой объект
a = b2; //
Print( a, ":", b1, ":", b2 );
}
Kaspersky has been yelling at the terminal trying to update for the last week.
all clear, build 1545. including kaspersky says all clear
https://www.virustotal.com/ru/file/2c3bf04666714cfac26e6e1c0fe355c6081554a0c2a15434849b0a5c241c95b0/analysis/1487685060/