In the class below, would this mean that onPaintCallback is NULL, or must I make it NULL in the class constructor? I want to start checking for NULL before it is given a valid pointer.
class AguiWidgetBase
{
virtual void onPaint();
void (*onPaintCallback)(AguiRectangle clientRect) = 0;
public:
AguiWidgetBase(void);
~AguiWidgetBase(void);
};
What you have isn’t legal. You have to initialize it in the constructor:
You could use
boost::function<void(AguiRectangle)>, which aside from being more flexible, initializes itself correctly to null. You can check it like: