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
Where is it going all the way?
Check your mail.
Hello, moderators! I asked a normal question to which I received rudeness. If you tear it down, tear down operators and pointers nonsense too.
And don't let Sokolov appear in OOP topics at all, with such advocates of OOP on the forum he will die in agony.
Hello, moderators! I asked a normal question, to which I received rudeness, so if you tear it down, tear down the nonsense about operators and signposts too.
And don't let Sokolov appear in OOP topics at all, with such advocates of OOP the forum will die out in agony.
A good example on the subject of OOP.
Have you clarified anything on your point of view? No.
Overriding operators gives nothing but syntactic sugar. It is better to abandon this practice and use Copy() or Clone() method instead of assignment operator - simple and clear:
Vasily, thank you for your opinion. I agree with your approach with one small addition:
Checking script:
Standard comparison characters are better left behind pointers.
What do you mean by pointers? In this sense?
Oh, my...
Have you explained anything about your point of view? No.
I won't give in to provocations of the haters, who are also illiterate, but rather explain my point of view:
In normal programming languages(not C++),overloading the '=' operator is forbidden. And in some, operator overloading is forbidden almost completely, as it is quite deservedly considered anti-pattern there. I suggest that before using any such overloading, especially assignment operator, those who wish, think hard about why those stupid architects of those stupid languages do that.
Couldn't resist, personally to andrei: geez, don't embarrass yourself like that. You are saying such silly things: first about FP, now about operators. Want to hayterite - welcome: give references to authoritative sources, justify, etc.. What you are doing now is a rabid and most importantly totally illiterate hatred. You seem to be a programmer, like even a real one - it is already shameful to write such things.
Artem, you're wrong. What can you do without girls? - The girls are all ours :-))
But seriously, here is what I want to discuss. There is a class where the copy constructor is written and the assignment operator is overridden. Question. When should they be and must they be different?
The compiler itself creates a simple copy constructor that simply copies all the members of the class or structure.
If you want other actions to be performed while copying, you may define your own copy constructor
and assignment operator.
The assignment operator is called for an existing object, so it must first check whether the assignment
itself, then release the existing object if necessary, and then do the same thing as the constructor.