64,687
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cstdlib>
using namespace std;
void* operator new(size_t s){
cout << "in my new" << endl;
return malloc(s);
}
void operator delete(void *p){
cout << "in my delete" << endl;
free(p);
}
class A{
public:
A(){
cout << "A" << endl;
throw 0;
}
};
int main(){
try{
A *pa = new A();
}catch(...){
cout << "抛出异常了" << endl;
}
system("pause");
return 0;
}