Implicit castable structs
Frank Benoit
keinfarbton at googlemail.com
Wed Jan 9 11:56:54 PST 2008
Kris schrieb:
> Yeah, that's old-school inheritance. But I think it's probably a bit dodgy
> to sidestep type-safety to do what you want. Besides, it's not hard to write
> this instead (the old school way):
>
> # gtk_widget_foo (&bin->container.widget);
>
hm yes, this is certainly true.
GtkMessageDialog* msgdlg;
gtk_widget_foo (&msgdlg.dialog.window.bin.container.widget);
gtk_widget_foo (cast(GtkWidget*)msgdlg);
Both are bad, the second can be shorter.
Even if i hate explicit upcast, in this case I prefer it :)
More information about the Digitalmars-d
mailing list