@In this order of declaration,items_array is destroyed before the array of objects array [5] is destroyed. In the Destroy() function, which is called from theitems_array destructor, the work is done with pointers to still existing objects, so no errors occur.
Hi everyone!
This is where I don't understand the logic at all. =)
After all, in the Destroy method we compare the type of our pointer with a dynamic type. And our type is automatic. Therefore, the delete operator is not used.
But it is not necessary, because automatically created objects are deleted automatically.
And lastly, the file forgot to specify the type of return value void for the Destroy and SetArray methods at the stage of implementation of methods outside the Class, because of which it throws an error.
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.
In the File localvar_testscript_4.mq5
If after the call to GetPointer(), we print the pointer type, it tells us that the pointers are POINTER_AUTOMATIC not POINTER_DINAMIC.
Therefore this line is never executed
<quote.
@In this order of declaration,items_array is destroyed before the array of objects array [5] is destroyed. In the Destroy() function, which is called from theitems_array destructor, the work is done with pointers to still existing objects, so no errors occur.
Hi everyone!
This is where I don't understand the logic at all. =)
After all, in the Destroy method we compare the type of our pointer with a dynamic type. And our type is automatic. Therefore, the delete operator is not used.
But it is not necessary, because automatically created objects are deleted automatically.
And lastly, the file forgot to specify the type of return value void for the Destroy and SetArray methods at the stage of implementation of methods outside the Class, because of which it throws an error.
Newbies (like me) may be scared =)