Should added members be proteced or private?

Tom Tromey tromey@cygnus.com
Fri Jul 28 22:18:00 GMT 2000


Jeff> Should I keep everything that is not in the API spec as private,
Jeff> or can I used friendly/default or protected as necessary? I
Jeff> assume I should not add anything public to the class.
I personally always use "private". I find that more clear. I only
use the default protection in those cases where I definitely need
access from some other class in the package.
Definitely do not add new public or protected fields or methods.
If the class is serializable you might also consider making sure your
implementation conforms to the serialization spec.
Tom


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /