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
is also in the custody of the moderators
Whoever said anything about custody... but a character with two eccentricities...
also under the tutelage of the moderators
I seem to have deleted my own post.
This was the case when an object is created in a function via new. Originally, we talked about passing a pointer to an existing object. And here, it can be passed like this:
void f(CObj * obj){}
And if a pointer needs to be passed to a function to create an object in the function, that's how it works:
That's all you wanted to know about OOP, but were afraid to ask)))This code kicks out the terminal for me. At best, it causes a critical error in debugging (for animation click on the picture):
Strange that such a construct gets skipped by the compiler.
Dmitry gave the first example with an error, and what's wrong with that?
Dim, yes it compiles without errors, but when you run the script, an error occurs.
Vladimir corrected it and added a pointer, the code worked correctly.
What else do we need? Now we have to find out who is the coolest? ))))
Guys, be respectful of each other, and do not resort to personalities and insults with arrogance.
Initial example from Dimitri
Correction by Vladimir.
My correction with a print of the method result, to verify
This example is now working, what more do you need?
Stop trying to figure out who is cooler or not, everyone has typos and errors.
In the course of these arguments, I think we've identified a compiler error.
Why does the compiler skip compiling Dmitri's initial example without errors?
This code kicks out the terminal for me. At best, it causes a critical debugging error:
It's strange that such a construct gets passed by the compiler.
Everything is valid for the compiler here.
A pointer to an object in the program data segment is created and is 0x0 initiated during compilation.
Necessary commands to the processor are created in the code segment.
At runtime, commands are raised on the stack at the address of the z(...) function.
And there move rdx [0x0]
And accessing a null memory address is forbidden. The dereferencing of a null pointer is called
Everything is valid for the compiler here.
For which compiler?
This code kicks out the terminal for me. At best, it causes a critical error in debugging (for animation click on the picture):
Strange that such a construct gets skipped by the compiler.
Mine compiles, works correctly, but shows a memory leak (delete doesn't work) message on completion.
You'll teach him the bad stuff now, it's the good stuff that needs to be dealt with )))
You didn't sit with the fxsaber codes for nothing. It sounds like a masterpiece to me.
Apologies for the misinformation, I wrote earlier that you can't call the Create() method in a child class.
Now double-checked, you can. But access to private member m_button was unavailable. I.e. it was impossible to check, for example, button's state: pressed/released.
Now with Igor's hint it's possible.