P
pbartosz
#include <iostream>
struct exception {};
struct file_exception: public exception {
};
void ex() throw(file_exception) {
throw new file_exception();
}
int main()
{
try {
ex();
}
catch (file_exception) {
std::cout << "catched\n";
}
return 0;
}
I get the message: "terminate called after throwing an instance of
'file_exception*'".
Why can't I catch the file_exception?
struct exception {};
struct file_exception: public exception {
};
void ex() throw(file_exception) {
throw new file_exception();
}
int main()
{
try {
ex();
}
catch (file_exception) {
std::cout << "catched\n";
}
return 0;
}
I get the message: "terminate called after throwing an instance of
'file_exception*'".
Why can't I catch the file_exception?