I was wondering if an object is dynamically allocated and the constructor throws an exception, does the object still need to be deleted ?
class Doom
{
public:
Doom() { throw 0; }
private:
int pad;
};
int main()
{
try
{
// memory is allocated for Doom but construction fails
// is the memory deallocated if construction fails here ?
Doom* doom = new Doom();
}
catch(int ex)
{
// ...
}
}