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
that makes sense
but I suspect that the whole point is to use it with static methods
I need to test it, but I don't know how, so I asked
UPD: googled this topic yesterday, lots of mentions of private destructor, also need to think what it can do
Static methods don't have a this pointer, and can't do anything by that pointer.
Private destructor guarantees that the object will be deleted by the object itself. But as I said above, it's not a good practice to avoid in my opinion (although, sometimes it's quite handy, and in SEVERAL cases it's acceptable to use it).
Static methods do not have a this pointer and cannot do anything with this pointer.
I may have misunderstood your message, but I am aware that the method does not have a pointer to this , only the object instance itself does , I wrote because from the static method class fields are available, and most likely you can manipulate with the deletion
the goal is to look at this design, I have never tried it, and it is not a common way
1) From static methods, access to this is forbidden.
Where's "delete &this;" - https://stackoverflow.com/questions/447379/what-is-the-use-of-delete-this
2) The private destructor forbids creating an object on the stack, but you can still create it through the new operator, this time in the heap:
Here's another use of delete &this.
thanks, i'll check it out, it's useful
busy, all in repair, I'll ask more later... just off the top of my head, what happens if a base class has a method with
and from a derived class call a method with the base class removed.... no practical purpose, but for now I want to figure it out
I may have misunderstood your message, but I am aware that the method does not have a this pointer, only the instance of the object itself does, I wrote it because the class fields are available from the static method, and most likely you can manipulate with deletion
so far the purpose of looking at this design, i have never tried it and it is not a common way
Thanks, I'll check it out, it's helpful.
Busy, all in repairs, I'll ask more later... just off the top of my head, what happens if a base class has a method with
and from a derived class call a method with the base class removed.... no practical purpose, but for now I want to figure it out
Don't bother, you'll never need it.
You need to understand the basics of the language before you deal with such things.
Don't bother, you'll never need it.
That's not a correct statement, if you don't expand your horizons, of course you won't need to.
You need to understand the basics of the language before you tackle such things.
I do it as much as I can, but in general I solve 90%+% of MQL-problems on the fly, the problems are usually typical and most have already been solved and are freely accessible.
concerning delete &this; ... ... I used a class-order that monitored its opening and at requotes was able to reopen the order ... ... and many other things,
i created and deleted this object (order class) from another class, i might find it more convenient to usedelete &this;...
I wonder if this is a glitch or a feature)
There is a structure inside the class instance.
I put a dot to see the contents of the structure.
But it is only displayed if I put square brackets.
Although the structure is in a single instance.
the problem is solved if the class is not an array element.
and the code itself for "poking around"
I wonder if this is a glitch or a feature)
There is a structure inside the class instance.
I put a dot to see the contents of the structure.
But it is only displayed if I put square brackets.
Although the structure is in a single instance.
the problem is solved if the class is not an array element.
and the code itself for "poking around"
this might be right :-)
that's probably right :-)
maybe) but it doesn't change the point about the tooltip)
I wonder if this is a glitch or a feature)
There is a structure inside the class instance.
I put a dot to see the contents of the structure.
But it is only displayed if I put square brackets.
Although the structure is in a single instance.
the problem is solved if the class is not an array element.
and the code itself for "poking"
https://www.ibm.com/support/knowledgecenter/ru/ssw_aix_72/performance/coding_style_best_perf.html
Везде, где это возможно, заменяйте глобальные переменные локальными.
It takes more commands to access global variables than it does to access local variables. In addition, unless explicitly stated otherwise, the compiler assumes that the called subroutine can change the values of all global variables. Thus, after the subroutine is called, the values of all global variables are loaded into memory repeatedly, which leads to performance degradation.
If you need to access a global variable (which is not shared by this thread and others), copy its value into a local variable and work with the copy.
Using a local copy gives a performance gain, except when the global variable is accessed only once.
If in my example:
in the onTick() method copy the values of Ask and Bid and use _Ask, _Bid (virtual trade) in the rest of the methods
will it be like working with global variables?
ZS: as an option, of course I can pass by reference &tick in all methods, but again, questions what is more effective
https://www.ibm.com/support/knowledgecenter/ru/ssw_aix_72/performance/coding_style_best_perf.html
if in my example:
copy the asc and bid values in the onTick() method and use _Ask, _Bid (virtual trade) in the rest of the methods
will it be like working with global variables?
ZS: as an option, I can of course pass by reference &tick to all methods, but again, questions what is more effective
https://www.ibm.com/support/knowledgecenter/ru/ssw_aix_72/performance/coding_style_best_perf.html
If in my example:
in method onTick() copy the values of asc and bid and use _Ask, _Bid (virtual trade) in other methods
will it be like working with global variables?
ZS: as an option, of course I can pass by reference &tick in all methods, but again, questions what is more effective