If I want to throw an instance of a class, where should I alloc the exception object?
Should I use heap:
try{
throw new Exception("An error was found");
}
catch(Exception* e){
std::cout << e->get_message() << "\n";
delete except;
}
or should not use heap:
try{
throw Exception("An error was found");
}
catch(Exception& e){
std::cout << e.get_message() << "\n";
}