I get an error
error: declaration of 'virtual FXHost::~FXHost()' throws different exceptions error: than previous declaration 'virtual FXHost::~FXHost() throw ()'
I am not sure how to start this decision, I have never come across this before.
in my .h I have:
public: virtual ~FXHost() throw();
in my .cpp I have:
FXHost::~FXHost() { gHost = NULL; }
Pointers appreciated.
throw() at the end of a function declaration is an exception specification. This means that the function never throws an exception. This cannot be overridden (only limited further) in derived classes, hence an error.
throw()
Since your implementation does not throw exceptions, all you need to do is add throw() to the destructor declaration.
See here why you should (not) use this (incorrect) C ++ function
FXHost::~FXHost() throw() { gHost = NULL; }
Your implementation should be at least restrictive in terms of throwing exceptions as its declaration.
Do you want to:
Although this destructor offers poor design, it is unlikely that the destructor will work correctly by pointing a pointer, even a global pointer, to NULL.