帮忙看一下这段程序的运行过程
程序代码:
#include <iostream> #include <stdlib.h> using namespace std; class Obj { public: Obj(void) { cout<<"Initialization"<<endl; } ~Obj(void) { cout<<"Destroy"<<endl; } void In(void) { cout<<"In"<<endl; } void Destroy(void) { cout<<"Destroy"<<endl; } }; void UseMallocFree(void) { Obj *a=(Obj *)malloc(sizeof(Obj)); a->In(); a->Destroy(); free(a); } void UseNewDelete(void) { Obj *a=new Obj; delete a; } int main() { Obj obj; // UseMallocFree(); UseNewDelete(); }