萌新求助一道C++试题
#include<iostream>using namespace std;
class A
{
int num;
public:
A()
{num=0;cout<<"A default constructor"<<endl;}
A(int n)
{num=n;cout<<”A constructor,num=”<<num<<endl;}
~A()
{cout<<"A destructor,num="<<num<<endl;}
};
void main()
{
A a,*p;
p=new A(2);
a=*p;
delete p;
cout<<”Exiting main”<<endl;
}