#include using namespace std; void BadFunctionCall(void) { throw 20; } class PtrUsrT { public: PtrUsrT(size_t s) { size = s; int * data = nullptr; data = new int[s]; // some computations BadFunctionCall(); // other computations delete [] data; return ; } private: size_t size; }; int main() { try { PtrUsrT p(4); } catch (...) { cout << "Caught an error " << endl; } return 0; }