CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
exctest3.cc File Reference
#include <iostream>

Go to the source code of this file.

Classes

class  Exception
 
class  Oops
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 24 of file exctest3.cc.

24 {
25
26 try {
27 cerr << "Starting main() ..." << endl;
28 cerr << "About to: throw( Oops(\"Ouch\") )" << endl;
29
30 try { throw Oops("Ouch"); }
31 catch ( const Exception & x ) {
32 x.f();
33 throw;
34 }
35 catch ( ... ) {
36 cerr << "Caught unknown!" << endl;
37 throw;
38 }
39
40 // Unreachable statement (we certainly hope!):
41 cerr << "The following ought to produce a compilation warning \n"
42 << "Got past: throw( Oops(\"Ouch\") ) -- not good!" << endl;
43 }
44 catch ( const Oops & egad ) {
45 cerr << "Caught: Oops" << endl;
46 }
47 catch ( const Exception & egad ) {
48 cerr << "Caught: Exception" << endl;
49 }
50 catch ( ... ) {
51 cerr << "Caught: don't know what" << endl;
52 }
53
54 cerr << "Done." << endl;
55 return 0;
56
57} // main()
virtual void f() const
Definition: exctest3.cc:12
Definition: exctest2.cc:14