fork download
  1. Person& operator=(const Person& other)
  2. {
  3. char* newname = NULL;
  4. try {
  5. newname = new char[strlen(other.name)+1];
  6. strcpy(other.name, name);
  7. std::swap(name, newname);
  8. delete [] newname;
  9. return *this;
  10. } catch(...) {
  11. delete [] newname;
  12. throw;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1: error: expected constructor, destructor, or type conversion before ‘&’ token
stdout
Standard output is empty