Re: GObject Interface vs Pure Virtual Class





On 5/12/07, Jean Bréfort <jean brefort normalesup org> wrote:
Le samedi 12 mai 2007 à 14:13 +0800, Kuang-Chun Cheng a écrit :
> Sorry if you receive this twice, I send this to gtk-devel-list which I
> registered before,
> but somewhat my email to gtk-devel-list bounce back ...
>
>
> Hi,
>
> I'm studying GObject system and found that I can implement both
> Pure Virtual Class (by setting all member functions NULL to make the
> class pure virtual)
> and an Interface in GObject.
>
> I'm a C programmer without much C++ experiences, but according
> to my understanding ... pure virtual class in C++ is Interface.  Am I
> correct ?
>
> My guess is, in GObject, provide extra API to implement an Interface
> is just another easier way to implement pure virtual class.
> GObject interface will add more internal check which is better
> than just set the member function to NULL, but ... there are
> the same stuff, am I correct ?
>
> Does any other good reason why GObject need an extra API set
> for Interface ?
>
> What's the different between Pure Virtual Class and Interface
> in GObject system ?

A GObject class can inherit from only one parent (which might be
virtual), but you can add as many Interfaces as you like. It is somewhat
similar to multiple inheritance in C++ (more like the D language
actually).

Hi Jean,

That's new to me ... I did not catch up this from GObject Ref. Manual ...
Thanks.

KC

Jean

> Regards
> KC
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
--
Jean Bréfort <jean brefort normalesup org>




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