Rethrow Sample: Demonstrates Rethrowing a Common Language Runtime Exception and Catching It as a C++ Exception
The Rethrow sample illustrates throwing an instance of System::Exception from a function. It then catches the common language runtime exception (System::Exception) and rethrows it. Finally, the rethrown exception is caught by a C++ catch block.
Building and Running the Sample
To build and run Rethrow using Visual Studio
- In the Visual Studio IDE, load the solution file Rethrow.sln.
- In Solution Explorer, right-click the Rethrow solution.
- On the shortcut menu, click Build.
- On the Debug menu, click Start.
The following output is displayed in the console window:
In handler 1 In handler 2
Classes and Keywords
This sample demonstrates the following class:
This sample demonstrates the following keywords:
try, catch, throw