Re: overwriting classes



joel krähemann wrote:
I'm to writing my own objects. They overwrite class
functions from parent objects and call the overwritten
functions later. But these functions aren't in the
header's. Is there something like a extendet
gtk+-2.4.2 where these functions are in the headers or
do I have to put them my self in there. If so do I
need to recompile gtk?

You need to store a pointer to the parent class, and then
just call its member function with this pointer.  I.e.

static void
XXX_class_init(XXXClass *class)
{
  parent_class = g_type_class_peek_parent(class);
}

static void
XXX_do_this_and_that(XXX *xxx)
{
  if (parent_class->do_this_and_that)
    parent_class->do_this_and_that(xxx);

  /* your code */
}

Paul



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