The overriden handle() and draw() in Fl_Group *ARE* still virtual, even
if there is no "virtual" specification in front of them (which can be
omitted in this case) because the base class (Fl_Widget) has them
virtual. This is C++ syntax stuff: once virtual, always virtual. It is
little bit ugly (I would prefer if C++ would give you syntax error if
you forget about it) but that is C++ specification says :-(

R.

Jose Marcelo Auler wrote:
>> I was trying to do my components based on the FLTK lib, but I figured out 
>> that the major of the components don't have virtual methods, so there is not 
>> way to do a secure inheritance. If, for instance, I specialize Fl_Widget to 
>> intercept some events by overriding int handle(int) method, and the user 
>> somehow calls the method by using a pointer to the basic class(Fl-Widget), I 
>> will have a not desired behavior. Is there a reason to have the classes this 
>> way(call speed?) and how the people are doing to specialize these 
>> classes(besides rewriting the fltk code, that I don't think is a good idea 
>> for maintenance)?
>> Thanks,
>> J.Marcelo Auler
> Sorry this wasn't a good example, actually the component I'm having trouble 
> is Fl_Group, Fl_Widget has virtual methods for draw and handle. The only 
> virtual method Fl_Group has is the destructor.
> 
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to