Re: Question regarding Java's OOP implementation.
- From: "Ingo R. Homann" <ihomann_spam@xxxxxx>
- Date: Tue, 15 Nov 2005 10:36:03 +0100
Hi,
what you proved with your code is the behaviour as it is specified. 'private' means that you cannot access the field from another class. It does not say that anything about different instances of the same class.
In fact, the problem of accessability is not as one-dimensional as the modifiers (from private to public) suggest. It has several dimensions:
(A) same class / subclass / different class
(B) same package / subpackage (which is not a concept that java supports (*)) / different package
(C) inner class / different class
(D) same instance / different instance
(E) friend class (unknown by java as well) / non-friend class
(F) ...
Of course the different options are not completely orthogonal, but there are much more potential combinations of access rights than just the 4 which java supports.
Ciao, Ingo
(*) a.b.c has nothing to do with a.b.c.d
.
- Follow-Ups:
- Re: Question regarding Java's OOP implementation.
- From: Thomas Hawtin
- Re: Question regarding Java's OOP implementation.
- References:
- Question regarding Java's OOP implementation.
- From: cwsummers
- Question regarding Java's OOP implementation.
- Prev by Date: Re: any VERY SIMPLE packages for reading and processing html files ?
- Next by Date: Re: Question regarding Java's OOP implementation.
- Previous by thread: Question regarding Java's OOP implementation.
- Next by thread: Re: Question regarding Java's OOP implementation.
- Index(es):
Relevant Pages
|