DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=k+8NxIMd7DbvEi7iz37KpxiQ7XVjK+xEJdylZqDY9G1YvOBSd3Sg1UIxvGfPn66DmeVwHRKH39osy0Lu3n/p5D4EmilBODyZyZSTVJvybEuYUwVcYpiGqhLGeSehJLrF2au72K6Su0qN+tpBKooOdSFUJ4sUpS6XgVidVGLnTH4= Message-ID: <6b8a914205081102267481b29b at mail.gmail.com> Date: Thu, 11 Aug 2005 11:26:27 +0200 From: Remi Vanicat To: "romildo at uber.com.br" Subject: Re: [newbie] Creating widget classes Cc: lablgtk at math.nagoya-u.ac.jp In-Reply-To: <20050811042345.GA29721 at malaquias> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline References: <20050811042345.GA29721 at malaquias> Content-Transfer-Encoding: 8bit 2005/8/11, romildo at uber.com.br : > Hello. > > I am starting to use the lablgtk library and > have some basic questions. > > I have seen some examples of new widget classes > defined as in the following example: > > class my_button ?label ?packing () = > let button = GButton.button ?label ?packing () in > object (self) > inherit GObj.widget button#as_widget > method relabel new_label = > button#set_label new_label > method print = > print_string (button#label); > print_newline () > end > > If I am not wrong, the button variable introduced > by the let binding is common to all instances > of the class (class variable). Well, the fact is that you are wrong. Those let binding let you define variable that are bound before the intialization of the object, when the instance variable are bound just before intialization method. Otherwise, they (instance variable and let binding before the object keyword) are private to each object.