Error C2679 binary '=': no operator found which takes a right-hand operand of type 'Example6'
And I have another question
I see in tutorial:
const string& content() const {return data;}
what is this const ... const? some reference?
why is Example6& operator= (Example6& x) "Example6 & operator..." this & and this
Example6 operator+(Example6 &temp) "&temp" don't work without &?
I know is referal, but i need to know thinking backwards
Error C2679 binary '=': no operator found which takes a right-hand operand of type 'Example6'
The problem is that the operator=(Example6& x) expects a reference of that object. The operator+(Example6 &temp) returns a temporary object that cannot used by non const reference.
what is this const ... const? some reference?
When used with an object const string&: the object shall not be modified.
When used with a member function content() const: The member function shall not modify any member variables.
why is Example6& operator= (Example6& x) "Example6 & operator..." this & and this
Example6 operator+(Example6 &temp) "&temp" don't work without &?
It actually works without '&'. With '&' it is passed by reference, without it is passed by value.