Article View: borland.public.jbuilder.java.language
Article #17967Returning Object Reference as parameters
From: Michael Nguyen
Date: Wed, 09 Sep 1998 00:00
Date: Wed, 09 Sep 1998 00:00
30 lines
1401 bytes
1401 bytes
I have a subroutine that takes in several objects of different types.
This subroutine would assign new objects to these parameters,
so that the caller can use them. To do this, I need to declare
both the variables in the caller and calle's parameters as arrays of
size one
as in the example below. Is there a better way around this
besides declaring a single java.Object array for all three elements ?
Thanks for the info.
Michael Nguyen,
Frontier Solutions, Inc.
void Caller ()
{
Class1 c1_array [] = new Class1[1], c1;
Class2 c2_array [] = new Class2[1], c2;
Class3 c3_array [] = new Class3[1], c3;
c1 = c1_array[0];
c2 = c2_array[0];
c3 = c3_array[0];
// now use c1, c2, and c3
}
void Calle (Class1 c1_array[], Class2 c2_array[], Class3 c3-array[])
{
c1_array[0] = new Class1 ();
c2_array[0] = new Class2 ();
c3_array[0] = new Class3 ();
}
Technical Details
Message-ID:
<35F6C181.E937734@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,8f52af31779ed231,start X-Google-Attributes: gidf74b3,public From: Michael Nguyen <michaelmn@home.com> Subject: Returning Object Reference as parameters Date: 1998/09/09 Message-ID: <35F6C181.E937734@home.com> X-Deja-AN: 389460152 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language