Hi, I'm trying to create my own object hierarchy, and I don't understand the part in the API reference about virtual functions and chaining up. To create a virtual public method, the docs say we need to do something like:
/* declaration in maman-bar.h. */ struct _MamanBarClass { GObjectClass parent; /* stuff */ void (*do_action) (MamanBar *self, /* parameters */); }; void maman_bar_do_action (MamanBar *self, /* parameters */); /* implementation in maman-bar.c */ void maman_bar_do_action (MamanBar *self, /* parameters */) { MAMAN_BAR_GET_CLASS (self)->do_action (self, /* parameters */); } I assume that the subclass definition looks like: struct _MamanBarSubClass { MamanBarClass parent; .... void (*do_action) (MamanBarSub* self, /* params */); } If the maman_bar_do_action actually needs to do something, and the derived class needs to chain up, wouldn't it result in another invocation of maman_bar_do_action which is again redirected to the derived class? This would of course result in an infinite loop. Please clarify. Thanks, -Nikhil _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list