[3526] in java-interest

home help back first fref pref prev next nref lref last post

Re: protected is not?

daemon@ATHENA.MIT.EDU (Aleph One)
Wed Nov 15 15:49:31 1995

Date: Wed, 15 Nov 1995 11:06:24 -0600 (CST)
From: Aleph One <aleph1@dfw.net>
To: satoh-HAL-osamu <satoo@pfu.fujitsu.co.jp>
Cc: java-interest@webrunner.neato.org
In-Reply-To: <9511150246.AA24608@thalia.trad.pfu.fujitsu.co.jp>

Trash the white paper and get the specs. From page 32, section 4.6: 
External Access.

Name may be used from outside the scope of their declaration as follows:

* for field names in the same package: if the is not declared private

So the ony way to hide it for other classes on the same package is to use 
private. To allow only subclasses to access it from direfent packages
you must use the modifier protected. Now the question is if the field is
private can subclasses access it? And if not are private and protected 
mutually exclusive? Iam sure the answer is in the spec but Iam to lazy to 
check.

Aleph One / aleph1@dfw.net
http://underground.org/
KeyID 1024/948FD6B5 
Fingerprint EE C9 E8 AA CB AF 09 61  8C 39 EA 47 A8 6A B8 01 

On Wed, 15 Nov 1995, satoh-HAL-osamu wrote:

> Date: Wed, 15 Nov 1995 11:46:28 +0900
> From: satoh-HAL-osamu <satoo@pfu.fujitsu.co.jp>
> To: java-interest@webrunner.neato.org
> Subject: Re: protected is not? 
> 
> > "protected" means that only extended class *and* other classes within
> > the same package can access the identifier.  Packages in the same class
> > are considered to be, well, "friendly".  This is one reason it is
> > important to package your classes correctly
> 
> In "The Java Language Environment: White Paper", I can find:
> 
> 	protected means that instance variable and methods
> 	so designated are accessible only to subclasses
> 	of that class, and nowhere else.
> 
> BUT, result of tests I did tell me that Ken is right.
> Does the white paper miss?
> 
> SATOH Osamu
> satoo@pfu.fujitsu.co.jp
> 
> 
> 
> 
> -
> This message was sent to the java-interest mailing list
> Info: send 'help' to java-interest-request@java.sun.com
> 
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post