Re: GObject Interface vs Pure Virtual Class
- From: Sven Herzberg <herzi gnome-de org>
- To: Kuang-Chun Cheng <kcc1967 gmail com>
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: GObject Interface vs Pure Virtual Class
- Date: Sat, 12 May 2007 23:50:01 +0200
Kuang-Chun Cheng wrote:
> 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 ?
GObject doesn't support multiple inheritance. So you can have only one
GObject-based parent class, but implement multiple interfaces.
Regards,
Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]