Question 6 Given the code below: class ExceptionA {}; class ExceptionB: public ExceptionA {}; class ExceptionC: public ExceptionA {}; void f1(int x) throw (ExceptionA, ExceptionB) { if (x % 2 != 0) throw ExceptionA (); throw ExceptionB(); } void f2 (int x) throw (ExceptionC, ExceptionA) { if (x <= 0) throw ExceptionC(); throw ExceptionA (); } } else void f3(int x) throw (ExceptionB, ExceptionC) { if (x 10) throw ExceptionB(); throw ExceptionC(); } else void f(void try { } else (*funcPointer) (int), int value) { funcPointer (value); } catch (ExceptionB) { cout << "Caught ExceptionB" << endl; } catch (ExceptionA) { cout << "Caught ExceptionA" << endl; } catch (ExceptionC) { } cout << "Caught ExceptionC" << endl; Write the output using the following main function: int main() { £ (£3, -10); £ (£3, 10); f(f2, -10); £ (£2, 10); f(f1, 20); f(fl, 11); return 0;
Question 6 Given the code below: class ExceptionA {}; class ExceptionB: public ExceptionA {}; class ExceptionC: public ExceptionA {}; void f1(int x) throw (ExceptionA, ExceptionB) { if (x % 2 != 0) throw ExceptionA (); throw ExceptionB(); } void f2 (int x) throw (ExceptionC, ExceptionA) { if (x <= 0) throw ExceptionC(); throw ExceptionA (); } } else void f3(int x) throw (ExceptionB, ExceptionC) { if (x 10) throw ExceptionB(); throw ExceptionC(); } else void f(void try { } else (*funcPointer) (int), int value) { funcPointer (value); } catch (ExceptionB) { cout << "Caught ExceptionB" << endl; } catch (ExceptionA) { cout << "Caught ExceptionA" << endl; } catch (ExceptionC) { } cout << "Caught ExceptionC" << endl; Write the output using the following main function: int main() { £ (£3, -10); £ (£3, 10); f(f2, -10); £ (£2, 10); f(f1, 20); f(fl, 11); return 0;
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
f18
In c++

Transcribed Image Text:Question 6
Given the code below:
class ExceptionA {};
class ExceptionB : public ExceptionA {};
class ExceptionC : public ExceptionA {};
void f1(int x) throw (ExceptionA, ExceptionB) {
if (x % 2 != 0)
throw ExceptionA ();
throw ExceptionB();
}
void
}
void
}
}
else
f2(int x) throw (ExceptionC, ExceptionA) {
if (x <= 0)
throw ExceptionC();
throw ExceptionA ();
}
else
f3(int x) throw (ExceptionB, ExceptionC) {
if (x < 10)
throw ExceptionB();
throw ExceptionC ();
void f(void
try {
else
(*funcPointer) (int), int value) {
funcPointer (value);
} catch (ExceptionB) {
cout << "Caught ExceptionB" << endl;
} catch (ExceptionA) {
cout << "Caught ExceptionA" << endl;
} catch (ExceptionC) {
}
cout << "Caught ExceptionC" << endl;
Write the output using the following main function:
int main() {
f(f3, -10);
f(f3, 10);
f(f2, -10);
f(f2, 10);
f(f1, 20);
f(fl, 11);
return 0;
Expert Solution

Step 1
According to the information given:-
We have to follow the instruction in order to get desired outcome.
Step by step
Solved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education