When I was reading:
What's the difference between assignment operator and copy constructor?
here: What's the difference between assignment operator and copy constructor?
The following example was shown:
A aa;
A a = aa; //copy constructor
vs:
A aa;
A a;
a = aa; // assignment operator
and my question is, why we need the assignment operator at all? I mean that it will be more efficient to use the copy constructor in this case while it does the same job.
could someone give a real-world example of the use of assignment operator where that can't be replaced by the copy constructor?