Article View: borland.public.jbuilder.java.language
Article #17893Re: How can I assign an Object reference to this in a constructor?
From: Tor Iver Wilhelmsen
Date: Thu, 17 Sep 1998 00:00
Date: Thu, 17 Sep 1998 00:00
22 lines
1441 bytes
1441 bytes
On Tue, 08 Sep 1998 16:11:09 +1200, Hamish McNeish <hamcneish@sol.otago.ac.nz> uttered: >I want to use my constructor to construct a new Object if one does not >exist otherwise I want to return a reference to an Object that matches >the Objects criteria. Look into using a static factory method to do what you want. >I tried to assign this to the object but my assignment is ignored >Extent t = this; >t = theObject; Your problem here is that "this" is a method-local reference; assigning to it has no effect on the object being initialized and assigned on the "outside" (one call level up). -- "I had to upgrade the memory of my 8088 from to 256K to 640K just to play [Demon's Winter]." - gmadison@usa.net Tor Iver Wilhelmsen http://www.pvv.org/%7etoriver/
Technical Details
Message-ID:
<3603e19c.3119776@news1.telia.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35F4AE5D.2990AADF@sol.otago.ac.nz>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,db7ece1bb334c6e2 X-Google-Attributes: gidf74b3,public From: toriw@online.no (Tor Iver Wilhelmsen) Subject: Re: How can I assign an Object reference to this in a constructor? Date: 1998/09/17 Message-ID: <3603e19c.3119776@news1.telia.com> X-Deja-AN: 392023603 X-NNTP-Posting-Host: 195.18.200.172 Content-Transfer-Encoding: 7bit References: <35F4AE5D.2990AADF@sol.otago.ac.nz> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@telia.no Organization: Viewpoint as (non-representative) MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language