All pastes #138114 Raw Edit

Something

public cpp v1 · immutable
#138114 ·published 2006-08-18 23:20 UTC
rendered paste body
class widget{public:	Widget(Widget *parent_)	{		parent = parent_;	}	static Widget *GetRoot()	{		static root = new Widget();		return root;	}	virtual ~Widget();		virtual void draw()	{		//some drawing code		for (int i = 0; i < widgets.size(); i++)			widgets[i]->draw();	}	virtual void update()	{		//some drawing code		for (int i = 0; i < widgets.size(); i++)			widgets[i]->update();	}		virtual void add(Widget *widget)	{		widget->parent = this;		widgets.push_back(widget);	}        private:	std::vector<widget *> widgets;	Widget *widget;	Widget();};