Last modified on 27 July 2012, at 14:29

GTK+ By Example/Glib/GObject

See the GObject Developer Docs.

See creating a Gobject for an example on deriving objects.

GObject is implemented in Glib and builds Objects in run-time (unlike C++ and many other object oriented languages which do this at compile tim).

  • similar to C++, using vtables.
  • explicit upcasting and downcasting.
  • Capable of meeting the three tenets of OOP. (See The Wikipedia Article).

ExampleEdit

create a person that says "hi my name is xxx". when person::talk is implemented

create an example dr_phil that inherits from person and says "And hows that working for you?" when person::talk is called.

this should provide us with deriving a first object, which is a pain to learn. and how inheritance works in Glib.

What needs to be explainedEdit

  • type check and type cast macros
  • the purpose of get type
  • the order in which objects are instantiated
    • creating object
    • construct and desctructor methods
    • the difference between class and instance
    • virtual functions