Is there any problem to create C++ classes from C (Gtk::Window, etc) ?



Hello. I have a very technical issue. If some expert could tell me if
it's wrong.
The issue is that I can do this:


GObject * obj = G_OBJECT(g_type_new("MycppClass", NULL));

as long as MyCppClass has this layout:

class .... {
   GObject parentclass;
   ...
};

If I define a virtual function, it won't work anymore. Is there any
workaround to this?
Because in the c gobject manual it says that the layout must be like
that, in order
for GObject to work, but for C++ it's very inflexible.

Is there any well-known solution to workaround the virtual table issue
and keep my classes
working in C? Thanks.


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