Re: question about instancing variables



On Wed, Jan 27, 2010 at 01:18:22PM -0200, Teste123 Teste123 wrote:
> All GTK+ codes that I see all variables are GtkWidget and after transformed
> for the widget. Example:
> 
> GtkWidget *button;
> 
> button = gtk_ button_new();
> 
> Why not directly:
> 
> GtkButton *button;

The constructors return GtkWidget*.

It can be discussed endlessly whether they should return GtkWidget* or
the specific type, anyway, you would have to do lots of typecasting in
both cases and this is simply the way it is.

Yeti



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