The return statement would be the keyword 'return' followed by whatever is being returned.
There's something about the value to be returned you didn't mention, and it might be central to your question.
There's a type to the value. Built in types like int, float, bool you probably know.
If you're writing a copy assignment operator, then you're most likely making a class. The type of what is to be returned is usually a reference to the class type. The text used to accomplish this is 'return *this;'
Ask if you don't recognize what 'this' is.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
class c
{
public:
// assume all the other required stuff is already in place
c & operator =( const c & i )
{
// deal with whatever is required to copy the details of i into this instance
return *this;
}
};
|
With that said, down the road in your study you're going to learn about all manner of details regarding how to more properly write a copy assignment operator or a copy constructor. I sense it is a bit early to deal with it now, but there are lots of 'wisdoms' on the subject.
On that point, if the 'const' doesn't make sense to you here, let that be an algebraic unknown for now that you'll get to. While it will compile without const, using it is among those things I'm referencing by 'wisdoms'.
If the '&' isn't clear, ask.
If *this isn't clear (beyond what 'this' means), same.