Re: glib abstract class vs interface



On Mon, Mar 12, 2007 at 10:26:15PM +0800, Kuang-Chun Cheng wrote:
> I'm recently study GObject and hope someone can explain
> the difference between
> 
> Abstract class defined by G_DEFINE_ABSTRACT_TYPE
> and interface.
> 
> I think if I use G_DEFINE_ABSTRACT_TYPE to create a
> class and define all member functions pointer to NULL (pure
> virtual) without implementation, then I will have an interface.

It could work this way in an object system that uses
multiple inheritance + purely abstract classes to express
interfaces (in the general sense), but GObject does not
permit multiple inheritance.

> So why GType introduce a new type called INTERFACE.
> What kind of new features are introduced in GType's interface ?

A GObject class can implement any number of interfaces.
However, it has exactly one parent class.

Yeti




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