1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /* boy.h */ #ifndef __BOY_H__ #define __BOY_H__ #include <glib-object.h> #define BOY_TYPE (boy_get_type()) #define BOY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),BOY_TYPE,Boy)) typedef struct _Boy Boy; typedef struct _BoyClass BoyClass; struct _Boy { GObject parent; // gint age; gchar *name; void (*cry)(void); }; struct _BoyClass { GObjectClass parent_class; // void (*boy_born)(void); }; GType boy_get_type(void); Boy* boy_new(void); int boy_get_age(Boy *boy); void boy_set_age(Boy *boy, int age); char* boy_get_name(Boy *boy); void boy_set_name(Boy *boy, char *name); Boy* boy_new_with_name(gchar *name); Boy* boy_new_with_age(gint age); Boy* boy_new_with_name_and_age(gchar *name, gint age); void boy_info(Boy *boy); #endif /* __BOY_H__*/ |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |