Answer to Question #269181 in C++ for Amit

Question #269181

WAP to show multiple throw statement execution by using suitable example.


1
Expert's answer
2021-11-21T04:51:18-0500

SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE

//In this question we will use multiple throws by re_throwing an exception

#include <iostream>

using namespace std;

 

int main()

{

    try {


        try {


            throw 40 ;


        }


        catch (int number) {


            cout << "Handling an exception ";


            // let us Re-throw the exception
             throw;


        }


    }


    catch (int number) {


        cout << "Handle remaining part of the exception";


    }


    return 0;

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS