{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Begin vend v autoptr beijing university of posts

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 重新抛出采用一个不带运算对象的throw语句 重新抛出的异常就是当初捕捉到的那个异 常,而不仅仅是异常处理器能访问到的那个 部分 Beijing University of Posts & Telecommunications Beijing [email protected] 重新抛出示例 void h() { try { // 可能抛出Matherr的代码 } catch(Matherr){ if(can_handle_it_completed){ //处理Matherr return; } else{ //完成这里能做的事情 throw; } } } Beijing University of Posts & Telecommunications Beijing [email protected] 14.3.2 捕捉所有异常 对于函数,省略号”…”表示“任何参数”,同 样,catch(…)表示要“捕捉所有异常” void m() { try { // 一些代码 } catch(...) {//处理所有异常 // 清理工作 throw; } } Beijing University of Posts & Telecommunications Beijing [email protected] 14.3.2.1 处理器的顺序 派生异常可能 被多于一个异 常类型的处理 器捕捉,因 此,在写try语 句时处理器的 排列顺序非常 重要 void f() { try{ //... } c...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern