大家分析一下这个c++程序问题所在!?
#include<iostream>using namespace std;
class Test
{
public:
int *p;
Test(int value)
{
p =new int(value);
}
~Test()
{
delete p;
p=NULL;
}
void PrintValue()
{
cout<<"The value is "<<*p<<endl;
}
};
void Func(Test t)
{
cout<<"the func"<<endl;
}
int main()
{
Test t1=33;
Func(t1);
t1.PrintValue();
return 0;
}
编译能通过,结果有问题!