[Gtk-sharp-list] default empty protected constructors (please
read this one instead of crapped previous one)
Mike Kestner
mkestner@speakeasy.net
Fri, 12 Jul 2002 13:16:19 -0700 (PDT)
On 12 Jul 2002, Radek [ISO-8859-1] Doulík wrote:
> why do we have constructors like this one?
>
> protected ScrolledWindow() : base(){}
If a class doesn't have a void ctor, we generate the above so that it can
be subclassed easily. I know this messes with customization possibilities,
because at one point I attempted to add a void Window ctor in a .custom
file.
> I would like to add new constructor to ScrolledWindow, but I can't do it
> yet because of mentioned protected one.
>
> public ScrolledWindow () : this (new Adjustment (IntPtr.Zero), new Adjustment (IntPtr.Zero)) {}
I know I suggested this on IRC last night, but thinking about it further, it
won't work. We need null handling to do this right. I logged a bug for null
handling already, but you might want to make a note that ScrolledWindow is a
good test case. :)
Since providing simplified "default" ctors is likely to be a common
customization, I'm thinking it might be worth adding a metadata category for
defining default parameter values for existing ctors.
Mike