C++析构有关问题

C++析构问题
#include<iostream.h>
#include<iomanip.h>
class MAT
{
private:
int m;
float *p;
public:
MAT();
MAT(int );
MAT( MAT& );
friend MAT operator+(MAT&,MAT&);
void show();
~MAT();

};
MAT::MAT()
{
m=0;
p=NULL;
}
MAT::MAT(int a)
{
int i=0;
m=a;
p=new float[m];
for(i=0;i<m;i++)
{

*(p+i)=i*m;
}
}

MAT::MAT(MAT&tt)
{
int i=0,j=0;
m=tt.m;
p=new float[tt.m];
if(tt.p!=0)
{
for(i=0;i<tt.m;i++)
{

*(p+i)=*(tt.p+i);
}
}
}

MAT operator+(MAT &a,MAT &b)
{
int i=0;
MAT temp_1(a.m);
for(i=0;i<a.m;i++)
{
temp_1.p[i]=a.p[i]+b.p[i];
}
cout<<"_in the operator_"<<endl;
temp_1.show();
return temp_1;
}

void MAT::show() //运行无误!
{
int i=0,j=0;
for(i=0;i<m;i++)
{
cout<<setw(7)<<*(p+i);
cout<<endl;
}
}

MAT::~MAT()
{

delete []p;
p=0;
}
int main()
{
MAT s1(3),s2(3);
s1.show();
s2.show();
MAT s3=s1+s2;
cout<<"_out the operator_"<<endl;
s3.show();
MAT s4;
s4=s1;
s4.show();
cout<<"&s1:"<<&s1<<endl;
cout<<"&s4:"<<&s4<<endl;

return 0;
}
发现析构的时候析构s1的时候发生错误,求解决。。。

------解决方案--------------------
重载操作符=。当你s4=s1;这样赋值的话,系统提供的=是浅拷贝。不安全。你需要把数据拷贝过去,而不是把指针的值赋值给另外一个。
------解决方案--------------------
探讨

重载操作符=。当你s4=s1;这样赋值的话,系统提供的=是浅拷贝。不安全。你需要把数据拷贝过去,而不是把指针的值赋值给另外一个。