🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17195

Re: Constructor referencing

#17195
From: Steve Schafer (TeamB)
Date: Tue, 01 Dec 1998 00:00
27 lines
1369 bytes
On Tue, 01 Dec 1998 09:49:17 -0500, Leo Cohen <lcohen@cs.virginia.edu>
wrote:

>I have a class, ViewManager with the constructor
>
>   public ViewManager(int view, String rootPath, Point locale) { ... }
>
>I want to include a second, convenience constructor as follows:
>
>   public ViewManager(int view, String rootPath, Point locale, UIMgr
>uiMgr) {
>      ... // set up things based on uiMgr
>      this(view,rootPath,locale);
>   }      
>
>However, the compiler tells me 
>
>	"method required, but value found."
>
>So, how do I reference a constructor with a different signature from
>inside a class?

Your example looks fine. One thing that may be tripping you up: The
call to this() must be the very first thing in the constructor, before
any other code and before any declarations.

-Steve
Technical Details
Message-ID: <36ec1941.636329665@90.0.0.40>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <366401ED.5D109EAB@cs.virginia.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,960f2d2dcd521e5a
X-Google-Attributes: gidf74b3,public
From: pandeng@telepath.com (Steve Schafer (TeamB))
Subject: Re: Constructor referencing
Date: 1998/12/01
Message-ID: <36ec1941.636329665@90.0.0.40>
X-Deja-AN: 417513000
Content-Transfer-Encoding: 7bit
References: <366401ED.5D109EAB@cs.virginia.edu>
Content-Type: text/plain; charset=us-ascii
Organization: TeamB
Mime-Version: 1.0
Reply-To: pandeng@telepath.com
Newsgroups: borland.public.jbuilder.java.language