ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Jenny <thomas.je...@starseed.ch>
Subject Re: Multiple classes in a single file (was: Re: Can someone tell me what is so great about Ant?)
Date Sat, 10 Feb 2001 08:02:01 GMT


"Richard S. Hall" wrote:
> Assume I have a public class called Public and it has exclusive access to a
> class called Exclusive.  My original thoughts were this, there are three ways to
> implement this:
> 
>   1. In separate .java files.  This is bad because other classes can have access
>      to Exclusive.
>   2. As an inner class of Public.  This is bad because it provides "friend"
>      access to Exclusive on Public; this is actually worse in my opinion than
>      the first solution because it may lead to unintended coupling as the
>      classes evolve.
>   3. As separate a class in the same file as Public.  This is good because it
>      eliminates the "friend" problem and the compiler complains if anyone else
>      tries to access the Exclusive class.

Really? Does the compiler really complain if anyone else tries to access Exclusive?
Mine doesn't.
As far as I understand, putting 2 java classes into the same file or
putting them in 2 separate files has no influence whatsoever on scope
and access restrictions.
Inner classes though can be used to restrict access, like you said
further below.


Regards,
	Thomas


-- 
Thomas Jenny                             thomas.jenny@starseed.ch
software architect
Starseed Enterprises AG, Zurich, Switzerland
http://www.personaljames.com

Mime
View raw message