#include <iostream> #include <string.h> using namespace std; class Person { public: Person(char *pN = "no name") { cout<<"Constructing "<<pN<<endl; pName = new char[strlen(pN) + 1]; if (pName) { strcpy(pName,pN); } } Person(Person &p) { cout<<"Copying "<<p.pName<<" into its own block"<<endl; pName = new char[strlen(p.pName) + 1]; if (pName) { strcpy(pName,p.pName); } } ~Person() { cout<<"Destructing "<<pName<<endl; pName[0] = '\0'; delete pName; } protected: char *pName; }; void main() { Person p1("randy"); Person p2 = p1; }