#include <iostream>
#include <stdio.h>
using namespace std;
struct A
{
A()
{
cout << "A()" << endl;
}
~A()
{
cout << "~A()" << endl;
}
};
int main()
{
A *pA=new A;
cout << "****************<1>**************" << endl;
A *pB=(A*)malloc(sizeof(A));
cout << "****************<2>**************" << endl;
delete pA;
cout << "****************<3>**************" << endl;
free(pB);
cout << "****************<4>**************" << endl;
return EXIT_SUCCESS;
}
运行结果: