#include "String.h" #include String& String::operator=(const String& d){ if(this != &d){ //evitare autoatribuire if(s) //curatire delete [] s; n=d.n; //copiere s=new char[n+1]; strcpy(s, d.s); } return *this; //intoarce referinta la obiectul modificat } String& String::operator=(const char* p){ if(s) delete [] s; n=strlen(p); s=new char[n+1]; strcpy(s, p); return *this; }