#include <iostream>
using std::cin; using std::cout; using std::endl; using std::cerr;
#include <string>
using std::string;
class HasPtr {
public:
HasPtr(const string &s = string()) :
ps(new string(s)), i(0) {};
HasPtr(const HasPtr &);
const string &get() const { return *ps;}
HasPtr &operator=(const HasPtr&);
private:
string *ps;
int i;
};
HasPtr::HasPtr(const HasPtr &s) :
ps(new string(*(s.ps))), i(s.i){};
HasPtr&
HasPtr::operator=(const HasPtr &hp) {
string *tmp = new string(*hp.ps);
delete ps;
ps = tmp;
i = hp.i;
return *this;
}
int main() {
HasPtr hp1("this is");
HasPtr hp2 = hp1;
cout << hp1.get() << "\n" << hp2.get() << endl;
}