[Gtk-sharp-list] MonkeyGuide?: Hello World in GNOME.NET - Third Draft

Charles Iliya Krempeaux charles@reptile.ca
19 Feb 2003 22:59:43 -0800


On Wed, 2003-02-19 at 22:42, Mike Kestner wrote:
> On Thu, 2003-02-20 at 00:07, Charles Iliya Krempeaux wrote:


> > The important thing to focus on is this line:
> > 
> >                     this.DeleteEvent += new
> > GtkSharp.DeleteEventHandler(delete_event);
> There is no need to use the "this" keyword anywhere in this class. Doing
> so is just extra typing. 

I wanted to use the "this" keyword for clarity.  (I find it helps
beginners alot.  A beginner will not know what a "DeleteEvent" is.
But with the "this" keyword there, they can immediately tell that
it is a property of the class they are using.)

> I'm also not excited about your coding style of splitting class/ctor
> declarations into two lines with the parent class and : on the second
> line, but I'm not going to lose any sleep over that.  :)


I got used to it in C++.  If you have something like:

    My_Constructor(int x, int y, int z)
        : base()
        , a(x)
        , b(y)
        , c(z)

Then you can get rid of one of the initializations with:

    My_Constructor(int x, int y, int z)
        : base()
        , a(x)
        , b(y)
    //    , c(z)

And then "c" won't be assigned.  But if I had the commas
at the end then I would have:

    My_Constructor(int x, int y, int z)
        : base(),
    //      c(z)

And that would case a (compile time) error.

See ya

     Charles Iliya Krempeaux, BSc

 Reptile Consulting & Services    604-REPTILE    http://www.reptile.ca/