Why are the "virtual" functions static?



Hi all,

I am relatively new with GTK and I believe I am misunderstanding the
concept of the type system. That is why I need a little help here.

Looking at the source files of GTK it looks like that all functions that
resemble C++ virtual functions and the type system configures when the
the type is created are declared as static. 
For example the widget's "realise" function. If I decide to write my own
widget deriving from the generic widget type I would initialize the
pointer in GtkWidgetClass to point to my own "realize" function and that
is all right. But when I start implementing my "realize" function I
would like to first call the "realize" function of the base class so it
can do its job and then proceed with my own code. The base class
function though is static and is not declared in the header file. I
thought probably there is a good reason for that and I shouldn't be
calling it. 

I thought probably I am thinking too much in C++ terms and probably
there is another way to accomplish this. I would highly appreciate if
somebody helps me with this.

Thanks in advance,
-Martin






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