G_OBJECT vs GTK_OBJECT

http://ts-hoop.blogspot.com/2008/03/gtkcasting.html的

看GTK的Casting發現一個小問題

提到這兩個型別轉換的問題,看了 Foundations of GTK+ Development的課本後,才發現這應該是版本的問題。

GObject is the fundamental type providing common attributes for all libraries based
on it including GTK+ and Pango. It allows objects derived from it to be constructed,
destroyed, referenced, and unreferenced. It also provides the signal system and object
property functions. You can cast an object as a GObject with G_OBJECT(). If you try to
cast an object with G_OBJECT() that is not a GObject or derived from it, GLib will throw a
critical error, and the cast will fail. This will occur with any other GTK+ casting function.

GtkObject is the base class for all GTK+ objects. It was replaced as the absolute base
class of all objects in GTK+ 2.0, but GtkObject was kept for backward compatibility of
nonwidget classes like GtkAdjustment. You can cast an object as a GtkObject with
GTK_OBJECT().

感謝你看到這裡,很快就可以離開了,但最好的獎勵行動就是按一下幫我分享或留言,感恩喔~

點我分享到Facebook

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。