GObject: Class and Instance Method



Hello,

I try to clear my mind but I didn't get satisfying answer.  The
documentation for GObject tells to declare "instance" methods like:

struct _FooClass
{
  GObjectClass parent_class;

  void (*bar)(Foo *self);
};
struct _Foo
{
  GObject parent_instance;
};

I understand it as the instance method for an object instance is
declared on the class. Declaring the method on the instance data
structure seems more logical to me. I mean something like this:

struct _FooClass
{
  GObjectClass parent_class;
};
struct _Foo
{
  GObject parent_instance;

  void (*bar)(Foo *self);
};

Why is the first version the prefered one? Are there advantages or do I
miss something relevant?

Greetings
Matthias Berndt

Attachment: pgpwD9TPsGzqj.pgp
Description: PGP signature



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