Re: Interfaces




Guillaume Laurent <glaurent@worldnet.fr> writes:

> Tim Janik <timj@gtk.org> writes:
> 
> > On 16 Apr 1999, Guillaume Laurent wrote:
> > 
> > > Tim Janik <timj@gtk.org> writes:
> > > 
> > > > the interfaces are meant to follow much the c++ style of signatures,
> > > 
> > > I'm not quite sure of what you mean by this...
> > 
> > take a look at the C++ Signatures:: node in your gcc info pages.
> 
> OK, found it. But that's a g++ extension, it's not C++.
> 
> > on the other hand, a bunch of the OO bindings already do things the
> > right way, e.g. with Gtk-- you simply use this->set_group(), no
> > matter whether this is a Gtk_RadioMenuItem or a Gtk_RadioButton
> 
> Yup. I guess I'm worrying too much, we probably won't need to wrap
> this at all.

If you do want to wrap it, I think the obvious way to do
it is the normal C++ way - pure virtual multiple
inheritance:

 class Gtk_Radio {
   virtual Gtk_RadioGroup *get_group () = 0;
   void set_group (Gtk_RadioGroup *group) = 0;
 }

 class Gtk_RadioButton : GtkButton, Gtk_Radio {
 }

(or whatever the correct syntax is). As far as I know,
there is no intention of providing inheritance of
implementation.

That gives you the right static class heirarchies.
If you want everything that you'll have in C (e.g.,
the ability to say: Does this GtkObject support
the GtkRadio interface?, then you'll need the
those fancy dynamic_cast, RTTI, etc, features.

                                        Owen

[ As always, I am not a C++ lawyer ;-) ]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]