異常處理的代碼編譯問(wèn)題
#include<iostream> #include<stdlib.h> using?namespace?std; #include"IndexException.h" void?test() { ?throw?10; } int?main?(void) { ?try ?{ ??test(); ?} ?catch?(CMemoryException?*e) ?{ ??cout?<<?"Exception"?<<?endl; ?} ? ?system("pause"); ?return?0; }
和老師講的一樣,但是會(huì)提示錯(cuò)誤
2016-08-22
int對(duì)應(yīng)的是你前面throw出來(lái)那個(gè)10的類型
2016-08-22
catch后面括號(hào)里的東西你是通過(guò)IDE環(huán)境自動(dòng)生成的,在這段代碼里應(yīng)該是catch(int)其中int對(duì)應(yīng)的是?