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

GObject is the fundamental type providing common attributes for all 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, 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

Print Friendly, PDF & Email


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料