Actually just solved it by deriving a class from it like so:
Code:
class FooStatus: public Status
{
public:
bool mightExplode()
{
return (bool)(ptrToStatus == NULL);
}
};
Then before calling the base-class to get the status I check:
Code:
Status Stat;
// if(Stat.getStatus() == statusOK) <<== original boom point
// {
// cout << "Status is OK. " << endl;
// }
// else
// {
// cout << "Status is not OK. " << endl;
// }
FooStatus *ptrFoo = static_cast<FooStatus*>(&Stat);
if(!ptrFoo->mightExplode())
{
// we are cool, call as usual
if(Stat.getStatus() == statusOK)
{
cout << "Status is OK. " << endl;
}
else
{
cout << "Status is not OK. " << endl;
}
}
else
{
cout << "FooStatus thinks this will explode:" << endl;
Stat.getStatus(); <<== in actual code this would not be there but for demo...
}
Sometimes the simplest answer is the best...