#include "stdafx.h"
#include<exception>
#include<iostream>
using namespace std;
class C_Father
{
public:
C_Father()
{
}
};
class C_Sun :public C_Father
{
//public:
// C_Sun() :C_Father(10)
// {
//
// }
int num;
};
int main()
{
C_Sun sun;
//try
//{
// char *str = new char[1024 * 10000000];
//}
//catch (std::bad_alloc)
//{
// cout << "1内存申请出现异常" << endl;
//}
//
//char *str = new(nothrow) char[1024 * 10000000];
//if (str == NULL)
//{
// cout << "2内存申请出现异常" << endl;
//}
system("pause");
return 0;
}
new失败返回的并不是NULL
最新推荐文章于 2022-11-06 13:59:01 发布