C++ Primer(第5版) 练习 13.11 练习 13.11 为前面练习中的HasPtr类添加一个析构函数。 环境:Linux Ubuntu(云服务器) 工具:vim 代码块 class HasPtr{ public:HasPtr(const std::string &s = std::string()): ps(new std::string(s)), i(0) {}HasPtr(const HasPtr &);~HasPtr() { delete ps;} private:std::string *ps;int i; };