Q:

C++ - calling to constructor on exist object

I saw some code that reconsruct Object on c++.
from GeeksForGeeks :
#include<iostream>
#include<string.h>
using namespace std;

class String
{
    char *p;
    int len;
public:
    String(const char *a);
};

String::String(const char *a)
{
    int length = strlen(a);
    p = new char[length +1];
    strcpy(p, a);
    cout << "Constructor Called " << endl;
}

int main()
{
    String s1("Geeks");  // line 1
    const char *name = "forGeeks";
    s1 = name; // line 3
    return 0;
}

Now, after line 3 s1 is a different object?
I always thought that after you construct object, you can't dereference it.

A:

What you see is an assignment.
A copy assignment operator is automatically generated in your class, since you don't define one yourself. From the page I linked to:

If no user-defined copy assignment operators are provided for a class
  type (struct, class, or union), the compiler will always declare one
  as an inline public member of the class.

