Getting a little confuse on this part.

I give an example:

Class A{
char *str;
int number;
public:
set(int);
printnumber();
};



int main()
{
A b;
int x =3;
b.set(x);
A c(&b) /*this calls copy constructor which is grand
A d = c /*this calls copy consturctor which is grand

A e;
e=b; /*doesnt call copy constructor*/
e.printnumber();


My question is what does the assignment operator do? Does it just copy the values across from B?
HOw is it different to the copy constructor?
Why do we need to overload the assignment operator if we overload the copy constructor?
I know it will print the value 3 out.

Thanks