高手帮忙看一下这个程序哪里出错了
#include <iostream> using namespace std;
class A { private: double* m_i; public: A(double i) { m_i = new double; *m_i = i; }
A(A& x) { m_i = x.m_i; cout<<*m_i<<endl; }
~A() { cout<<"m_i is: "<<*m_i<<endl; *m_i = -1; delete m_i; m_i = NULL; }
void print() { cout<<"the value is: "<<*m_i<<endl; } };
A f(A a) { return a; a.print(); }
void main() { A a(23); f(a); }