Shows how to use system_exception exception.
#include <xtd/console>
#include <xtd/guid>
 
 
long create_handle() {
  return reinterpret_cast<long>(
new guid());
 
}
 
void destroy_handle(long handle) {
  delete reinterpret_cast<object*>(handle);
}
 
auto main() -> int {
  try {
    
    
    
    destroy_handle(handle);
    console::write_line("Exception occured :");
    console::write_line("-------------------");
    console::write_line(e);
  }
}
 
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be us...
Definition guid.hpp:24