Let's see if I can clarify the reasoning in my previous message. I continue to use GooCanvas classes as an example, but now I'll turn to a syntax that resembles Java. The rules for inheritance hierarchies in C/GObject are more like Java than like C++: Only single inheritance between classes, but in addition to inheritance from a base class, a class can implement zero or more interfaces.
public interface GooCanvasItem; public class GooCanvasItemSimple implements GooCanvasItem; public class GooCanvasRect extends GooCanvasItemSimple implements GooCanvasItem; The repetition of "implements GooCanvasItem" in GooCanvasRect is perhaps not like Java, but it's GObject's way of overriding virtual functions declared in the interface. When gmmproc generates C++ wrappers for these entities, g_type_register_static() and g_type_add_interface_static() are called with the following results: Goocanvas::Item No new type registered, no interface added. Goocanvas:Item effectively renames GooCanvasItem, and defines C++ virtual functions. Goocanvas::ItemSimple public class gtkmm__GooCanvasItemSimple extends GooCanvasItemSimple implements GooCanvasItem; Goocanvas::Rect public class gtkmm__GooCanvasRect extends GooCanvasRect; I suspect that gtkmm__GooCanvasRect shall also implement GooCanvasItem, i.e. Goocanvas::Item::add_interface(get_type()) shall be called from Goocanvas::Rect_Class::init(). Otherwise the C++ virtual functions in Goocanvas::Item are never called in a class derived from Goocanvas::Rect. Since gtkmm__GooCanvasRect is not derived from gtkmm__GooCanvasItemSimple, gtkmm__GooCanvasRect (Goocanvas::Rect) does not inherit the implementation of GooCanvasItem functions defined in gtkmm__GooCanvasItemSimple (Goocanvas::ItemSimple). _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
