class Person{
public:
Person(string * n){
name = new string(*n);
}
//Copy constructor
Person(const Person &p){
cout <<"copy constructor called"<<endl;
name = new string(*p.name);
}
~Person(){
delete name;
}
protected:
string * name;
};
int main(){
string s1 ="Jimmy Bob";
string *ps = &s1;
Person p1(ps);
s1="voodoo";
ps = &s1;
Person p2(ps);
//WHY DOESN"T NEXT LINE CAUSE COPY CONSTRUCTOR TO BE CALLED?
p2 = p1;
}