Re: Is there any problem to create C++ classes from C (Gtk::Window, etc) ?
- From: Chris Vine <chris cvine freeserve co uk>
- To: Germán Diago <germandiago gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Is there any problem to create C++ classes from C (Gtk::Window, etc) ?
- Date: Sat, 7 Nov 2009 18:49:30 +0000
On Sat, 7 Nov 2009 18:56:02 +0100
Germán Diago <germandiago gmail com> wrote:
> I'm trying to (but I don't know if it's possible) to make polymorphic
> c++ objects usable from
> GObject in C.
If you mean that you want to access polymorphic c++ objects in C code
(that is, access them when actually programming in the C language) then
no. You would have to use GObject polymorphism throughout to do that,
which is entirely implemented in C.
But I am not sure that you do mean that as you can of course program
GObject code in C++ as well as C, and if you are programming in C++
then you can extract your polymorphic object in the way I have
mentioned. Thus if you wrote your implementation of g_object_new()
typed for your custom POD GObject (you can give any struct its own
GObject type with G_DEFINE_TYPE), you could (unbeknowst to GObject)
have a c++ polymorphic object standing behind it. At the end of the
day, you can cast to anything.
I have no idea how that interacts with glade I am afraid. Quite
probably it doesn't, in which case you can't do what you want.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]