Re: why do constructors return GtkWidget?

Whatever type is returned, you'll have to do lots of casts, so whatever
convention is used, there's no avoiding that. And returning GtkWidget*
is just the current convention.
I personally would prefer correct types to be used in the API, just to
show exactly what type to expect at runtime. But that's a separate
Thank you for the answer. If it doesn't make a technical difference I think returning the actual type would be much more useful, for documentation purposes. In the case of gtk_menu_shell_append() from the prototype you would think that it can take any GtkWidget and only the comment tells you that only GtkMenuItem* will do.

Well coming from object-oriented languages, this is all disappointing but that's the way it is. Maybe I'll give gtkmm a second thought though I'd prefer not to be "behind" bindings.


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