bad_exception::bad_exception() throw();
#include <exception>
#include <iostream>
#include <exception>
void ThrowBad() throw(std::bad_exception) {
throw std::bad_exception();
}
int main() {
using namespace std;
// The try-catch block allows us to handle exceptions
try {
// Call a function to throw an exception
ThrowBad();
} catch(const std::bad_exception& kqrException) {
cerr << "Message: " << kqrException.what() << endl;
cerr << "Type: " << typeid(kqrException).name() << endl;
}
// Keep the window open
std::cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.