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
There are no pointers here) There is a handle for the class, and working with it is similar to working with a pointer, but that's where the common ground ends.
My inquisitive mind and naughty hands kept me busy for two days and two nights
i tried to remove dynamically created object out of scope - in the function, groping method, but finally i got the solution:
that deletes it, but I can't figure it out like this.... and i haven't found any similar function signatures for passing the pointers
Here's another question:
how can I return a pointer to an object by reference as a result of a function?
I want to do something like this:
it is possible to returnCTest * without problems, but as I wrote ret_CTest() - it gives an error
Two days and two nights my inquisitive mind and naughty hands kept me busy
tried to remove dynamically created object out of scope - in the function, gut feeling method, but finally got to the solution:
that deletes it, but I can't figure it out like this.... and i couldn't find any similar function signatures for passing pointers in help or sat
What do you mean it's out of scope? You passed it into a function, so it's visible there)
s.s.void deleteCTest(CTest* &t) without that & should work too, right?
To really remove it outside the scope where it was created, and possibly automatically, you need ... shh... before anyone hears... Pattern Factory... read faster and delete...
Igor Makanu:
but how to return a pointer to an object by reference as a result of a function?
you can returnCTest * without problems, but as I wrote ret_CTest() - it gives an errorIf a class has a copy constructor, then it should have a copy constructor.
s.w.void deleteCTest(CTest* &t) without this & should work too, or no?
check it out, you'll learn something new ;)
I've written many times, that the MQL pointers are a very instructive thing ))))
If you want kosher, not yet, but if so:
If you want to use a pointer, the class must have a copy constructor.
Again, I need to think
I have a suspicion that GetPointer() may do some tricks... but it's not a fact.... These "jumps through space and time" - via pointer and implicit dereferencing in MQL - are out of my mind ! (((
check it out, you'll learn a lot ;)
I've written many times that pointers in MQL are a very instructive thing ))))
It deletes pointers but it cannot assign a new value to _test. By the way, MQL has nothing to do with it)))
check it out, you'll learn a lot ;)
I've told you over and over again that pointers in MQL are very instructive ))))
Again, I need to think
I have a suspicion that GetPointer() may do some tricks... but it's not a fact.... These "jumps through space and time" - via pointer and implicit dereferencing in MQL - are out of my mind! (((
It's OK here)))) Just turn off the sharpe, there's not even a hint of it here))))
check it out, you'll learn a lot ;)
I've told you over and over again that pointers in MQL are very instructive ))))
I checked it. It deletes well without &)
I tried it in MT4 and MT5 and compare )
Well checked. It deletes perfectly without &)
I tried it in MT4 and MT5 and compare )
Not a complete example, i ran into it today.
It will not work without & .
I am fine here))) I'm not looking for sharps but I'm sure it will work without &)).
I'm not looking for Sharp, I'm still dealing with MQL, I may ask what I do not understand.
not a complete example, I came across it today.
it won't work that way without &
not a complete example, I came across it today.
it won't work without &
In my opinion, it has nothing to do with references, but only with the fact that the function argument must be passed by pointer if you want it to save the value after the function is running. The same will happen with a file or indicator handle, for example, which are not references.
This has always been the standard in C++, although it's been a long time since I vaguely remember.