> Here's another approach, in outline (nb uncompiled/untested),
> that you can consider.
>
> class Control {
> public:
> virtual void set_value(int) = 0;
> virtual int get_value() const = 0;
> };
> class Slider : public Fl_Slider, public Control {
> public:
> Slider(int x, int y, int w, int h, char const* label = 0)
> : Fl_Slider(x, y, w, h, label)
> {;}
> void set_value(int v) { Fl_Slider::value(v); }
> int get_value() const { return Fl_Slider::value(); }
> };
>
> // similarly for other classes of interest
>
> Then, store a container of Control*, and proceed as Ian
> and others have suggested.
>
> To me it's more attractive than switch/case logic, but of course
> decide for yourself.
>
> HTH,
> Stan
Thank you,
I wish I could read C++ ... to be honest, I have no idea what the code does and
how to use it. You know, to me a Class is just some functions, called methods,
I can call. (like your code above, but simpler ^^)
Sometimes I dont know wether to create a new class or just add a function to an
existing class. Sometimes I dont know in which Class to put a method. Should it
be Class A or Class B?
Basically, I know the concept of classes, but I didnt understand how to make
use of them in a way that makes sense. You know what I mean? To me a program is
calling functions (simply put) and not classifying. :)
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk