You can catch the exception in the constructor body, perform the necessary cleanup, and then throw the exception with throw;
However, exceptions and manual memory handling do not go well together. You will be much better to use an object that automatically manages memory for the member c (eg std::string, std::vector<char>, std::unique_ptr<char[]>etc.). You really only need to explicitly manage the memory if you are writing a class similar to one of the above, the purpose of which is to take care of that memory.
source
share