Is there a way a class can delete itself? Given the following class:
class foo
{
public:
foo ()
{
if (exist)
delete ourself here;
else
exist=1;
}
private:
static int exist;
}
static int foo::exist=0;
I know it wouldn't work in this case since a call to NEW or declaring it
explicitly won't notify anybody of the error. Does anyone have a solution.