Accessing methods of parent objects?




I want to "derive" a new class from an existing class and have been using
the source for GtkTable (among other widgets) as a case-study.  I have
also read the brief but important remarks on inheritance in the GTK+
Reference.

The question arises, how does a child access the "public methods" of its
"parent" class?  What I have noticed in the examples I've studied is that
the derived class structure frequently contains no (!) "methods," other
than those required of the most general GtkWidget class.

Instead, the methods of the derived class are defined =globally= within
the <derived_class>.c file.  This is apparently so that the methods can
call each other without having to go through a (nonexistent) 
pointer-to-function in the _derivedClass structure. 

The upshot of this is that I don't know how to access a parent class'
class-specific "public" methods from a derived class.  To me, it would
seem convenient to "install" handles to all the public methods of a class
in the appropriate _Class structure, but perhaps this is not the only way. 

Can someone help me out here?  Let's make up a specific example: Suppose
we want to derive a new class called DTable from GtkTable.  And let
dtable be a new instance of DTable.  Now we need to "attach" some
children to dtable by calling the gtk_table_attach methods in the 
GtkTable (parent) class.  How do we do this?

Thanks for your time,
Kyle Ferrio




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]