> > > here's how things stand:
> > >
> > > class MainWindow {
> > > public:
> > >   MainWindow();
> > >   Fl_Window *mainWin;
> > >   ...
> >
> > why not have the following?
> >
> > class MainWindow : public Fl_Double_Window {
> > public:
> >   MainWindow(int X, int Y, const char* T = 0)
> >   : Fl_Double_Window(X, Y, T)
> >   {
> >     ...
> >   }
> >
> > I typed that in off the top of my head, but you get the idea.
> >
> > D.
>
> Can anybody suggest the main advantage of the above as opposed to my
> original version, it's just that i thought i had access to the window
> classes regardless of deriving from it in this way?
>

1. Polymorphism: MainWindow ISA Fl_Double_Window, and has access to
   all protected member variables and functions. In your version you
   only have access to the public member variables and functions.
   The programming interface is available for free, I don't have to
   recode anything unless I want to override it.

2. Reusability: because my MainWindow ISA FL_Widget, Fl_Group, and
   Fl_Double_Window, I can embed it in any other app that expects
   a widget, group or window. Don't forget that you can have windows
   as children of other windows as well as having top-level windows.

D.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to