Re: New to GObject, few questions
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: New to GObject, few questions
- Date: Fri, 21 Jul 2006 22:50:36 +0200
On Fri, Jul 21, 2006 at 10:22:19PM +0200, Tomasz Jankowski wrote:
I read few times "Gobject tutorial" provided with GLib's documentation but I
don't understood it enouhg good, maybe because I don't like (and know)
object languages, I know only C++ basics. So these are my questions:
I. What the Interfaces are? I don't understood their predestination? I
understood them as other type of Methods, but I'm know, that Interfaces
aren't Methods, can someone explain me it?
[quote from Sun]
An interface is a contract in the form of a collection of
method and constant declarations. When a class implements
an interface, it promises to implement all of the methods
declared in that interface.
[/quote]
This sums it up nicely, except in GObject there are other
things that can be part of an interface, namely signals.
But the principle is the same, an interface is a collection
of APIs a class can claim it provides.
For example, GtkTreeModel is an interface. So if you write
a new tree model it claims `I am a tree model' and it does
not have to derive from a specific parent class for that
(OK, interface in fact can impose parent class restrictions,
but that's a technical detail).
C++ has no direct analogue because it has multiple
inheritance so it doesn't need it.
II. For example, object "XXX" inherits from object "ZZZ"
Objects do not inherit, classes do.
and I defined
*_finalize () functions for object ZZZ, but I didn't define any *finalize
functions for object XXX. What will happen if I'll try to destroy XXX
object? Will ZZZ's *_finalize functions will be used?
Yes, it will. Moreover, if the class of XXX *does* define
a finalize method, it has to explicitly call the parent's
class finalize:
G_OBJECT_CLASS(parent_class)->finalize(object);
(see Gtk+ source code for examples).
III. What 'GTypeInstance' is?
GTypeInstance is a low-level construct in the type system,
it is `an instance of something that has a GType'. You
should never need it.
Yeti
--
Anonyms eat their boogers.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]