#include "mystring.h" #include MyString& MyString::operator=(const MyString& d) { if (this != &d) { // Evitare auto-atribuire if(s) { // Curatare delete [] s; } n = d.n; // Copiere s = new char[n + 1]; strcpy(s, d.s); } return *this; // Intoarce referinta la obiectul modificat } MyString& MyString::operator=(const char* p) { if (s) { delete [] s; } n = strlen(p); s = new char[n+1]; strcpy(s, p); return *this; }