String operator

I'm pretty new to c++, and am currently trying to pick my way through some code for a University project.

I am struggling to find any reference material on the below construction:

Class& Class::operator=(const Class& Object){

if(this!=&Object) {......}

return *this;
}

I would much appreciate it if someone can shed some light on what it does?

Thanks.
This is for when you say something like:

class obj1 = obj2;

It's part of operator overloading, so not really to do with strings unless you want it to be. It's more general that that. Basically, it's for getting the = symbol to do what you want, which is generally to make this equal to that.

Thanks but I was under the impression (probably wrongly) that the construction for operator overloading is:

Class::operator=(Class Object)

What does the additional syntax do?

Again much appreciated..
The first Class& says that the function returns a reference to the class object.

The const in the parameter list is to prevent the function from changing the object on the right-hand-side of the = sign, and the & in the parameter list passes a reference rather than a copy, which is more efficient on memory/cpu usage.
Thank you so much!
Topic archived. No new replies allowed.