


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Stack Unwinding, Flow control of throw, Return statement, Calling function, Nested function calls, Function abort, Nested try blocks, Catch Handler, Body of main Function are main points of this lecture.
Typology: Slides
1 / 26
This page cannot be seen from the preview
Don't miss anything!



















Object-Oriented Programming (OOP) Lecture No. 44
class DivideByZero { public: DivideByZero() { } }; int Quotient(int a, int b){ if(b == 0){ throw DivideByZero(); } return a / b; }
function2()
main()
function1()
function2() main()
main()
int Quotient(int a, int b) {
if(b == 0){ throw DivideByZero(a); } return a / b;
}
for ( int i = 0; i < 10; i++ ) { try { GetNumbers(a, b); quot = Quotient(a, b); ... } catch(DivideByZero & obj) { obj.Print(); i--; } } cout << “\nSum of ten quotients is ” << sum;
try{ ... } catch(DivideByZero){ ... } catch(IntergerOutOfRange){ ... } catch (InputStreamError){ }
try{
...
}
catch (MathError){
}
catch (InputStreamError){
}