(Uncaught Exceptions) Write a program that illustrates that a function with its own try block does not have to catch every possible error generated within the try. Some exceptions can slip through to, and be handled in, outer scopes.
What will be an ideal response?
```
#include
#include
using namespace std;
// class TestException1 definition
class TestException1 : public runtime_error
{
public:
// constructor specifies error message
TestException1::TestException1( const string &message )
: runtime_error( message ) {}
}; // end class TestException1
```
```
#include
#include
using namespace std;
// class TestException2 definition
class TestException2 : public runtime_error
{
public:
// constructor specifies error message
TestException2::TestException2( const string &message )
: runtime_error( message ) {}
}; // end class TestException2
```
```
#include
#include "TestException1.h"
#include "TestException2.h"
using namespace std;
void f()
{
throw TestException1( "TestException1" );
} // end function f
void g()
{
try
{
f();
} // end try
catch ( TestException2 &t2 ) // catch TestException2
{
cerr << "In g: Caught " << t2.what() << '\n';
} // end catch
} // end function g
int main()
{
try {
g();
} // end try
catch ( TestException1 &t1 ) // catch TestException1
{
cerr << "In main: Caught " << t1.what() << '\n';
} // end catch
return 0;
} // end main
```
In main: Caught TestException1
You might also like to view...
Answer the following statements true (T) or false (F)
1. On a traditional IBM mainframe, the new PSW holds the address of the CVT. 2. On a traditional IBM mainframe, when an interrupt occurs, hardware stores the current program status word in the new PSW field and then loads the old PSW into the current PSW register. 3. Traditional IBM mainframes recognize six different interrupt types. 4. On a traditional IBM mainframe, an external interrupt comes from the operator’s console, another processor, or the timer. 5. On a traditional IBM mainframe, a supervisor call (SVC) interrupt is issued when a program executes an illegal instruction.
Jenny is working on a laptop computer and notices that the computer is not running very fast. She looks and realizes that the laptop supports 8GB of RAM and that the computer is running only 4GB of RAM. Jenny would like to add four more gigabits of RAM. She opens the computer and finds that there is an open slot for RAM. She checks the other module and determines that the module has 204 pins. What module should Jenny order?
A. SO-DIMM DDR B. SO-DIMM DDR2 C. SO-DIMM DDR3 D. SO-DIMM DDR4
The x-axis is also known as the:
What will be an ideal response?
An image of a computer screen is called a ________
A) monitor B) screen shot C) clip D) document