Re: Derived interfaces
- From: Owen Taylor <otaylor redhat com>
- To: murrayc usa net
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: Derived interfaces
- Date: 03 Nov 2001 17:32:15 -0500
murrayc t-online de (Murray Cumming) writes:
> On Sat, 2001-11-03 at 19:00, Owen Taylor wrote:
> >
> > murrayc t-online de (Murray Cumming) writes:
> >
> > > I read somewhere that glib interfaces could be derived from other
> > > interfaces. Does anyone know of an example?
> >
> > The way this is mapped is as "prerequisites" - an interface
> > can require that any type implementing it also "is a" some
> > set of other types, either interface types or instance
> > types.
> >
> > void g_type_interface_add_prerequisite (GType interface_type,
> > GType prerequisite_type);
> >
> > E.g., GtkCellEditable (what should have been GtkCellEditor)
> > has a prerequisite on GtkWidge.t
> >
> > Regards,
>
> So, if interfaces can't really be inherited, what does this do:
> gpointer g_type_interface_peek_parent (gpointer g_iface)
There are two types of interface derivation:
- "Deriving" an interface from another interface. That
is "interface B extends interface A". The way that you
do this in GTK+ is that you say "if the class has
interface B then it must also have interface A".
- Deriving the _implementation_ of an interface from
your parent type and then possibly overriding some
methods.
g_type_interface_peek_parent() is for chaining up in
the latter case ... you pass in the interface class structure
for the derived class, and it gives you the interface
class structure for the parent class.
Both of these could be mapped onto class inheritance
in C++.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]