Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

  • Print
  • + Share This
Like this article? We recommend

Widget Class Implementation

Listing 8 illustrates the Widget base class implementation.

Listing 8 Widget Implementation Code

Widget::Widget(ConnectionDirector* aConnDirector)
{
  _director = aConnDirector;
}

void Widget::Changed(void)
{
  _director->WidgetChanged(this);
}

The constructor for Widget is passed a pointer to an instance of ConnectionDirector. This pointer is stored in the data member _director. Remember that the widgets tell the mediator about changes applied to them? Well, the Changed() member function serves this purpose. You’ll soon see how this is done when we look at the PathWidget implementation.

  • + Share This
  • 🔖 Save To Your Account