阿里巴巴一道笔试题

来源:互联网 发布:哪些淘宝店铺适合学生 编辑:程序博客网 时间:2024/05/16 19:05

#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;
}

 

运行结果:

原创粉丝点击