I have a class, WIDGET.
Code:class WIDGET{
public:
WIDGET();//constructor
~WIDGET();//destructor
int uid();//returns UID
protected:
WIDGET* parent;//parent widget pointer
WIDGETINFO info;//widget data info stuff, yeah...
std::queue<EVENT> events;//Event queue
CRONOS* cronosInstance;//cronos instance
EVENTMANAGER* eventManInstance;//event manager instance
WIDGETMANAGER* widgetManInstance;//widget manager instance
static char* typeName;//widget type name
};
And my derived BUTTON class.Code:char* WIDGETMANAGER::typeName = "WIDGET";
Code:class BUTTON:public WIDGET{
public:
BUTTON();
~BUTTON();
private:
protected:
};
However, as I'm sure you've already concluded this throws an error.Code:char* BUTTON::typeName = "BUTTON";
I guess I could stick this->typeName in the constructor for each derived class but I just thought keeping a static member would be easier and probably more efficient.Quote:
ISO C++ does not permit `WIDGET::typeName' to be defined as `BUTTON::typeName'