c++ 异常机制

一、一个例子

#include <iostream>
using namespace std;

int main()
{
	try {
		if (1) {
			throw exception();	//catch中用引用。
//			new throw exception();	//catch 中用指针。
		}
	} catch (exception &e) {
		cerr << "catch exception\n";
	}

	return 0;
}

二、标准库里的异常类型

catch(…)

..

posted @ 2013-04-19 18:12  helloweworld  阅读(118)  评论(0编辑  收藏  举报