This page is no longer maintained — Please continue to the home page at www.scala-lang.org

RE: For the first time, I see the problems with making "public" the default access for members

No replies
Detering Dirk
Joined: 2008-12-16,
User offline. Last seen 42 years 45 weeks ago.

> > However, now I'm in a situation where I have a root class, and five
> > or so subclasses of it that implement most of the non-public methods.
> > And I've found that while my access settings are correct in the root
> > class, I've managed to forget quite a few of them in the subclasses
> > and am having to go through and check everything by hand. Ugh.
> >
> > Maybe we could have a new keyword that says access restrictions must
> > apply to subclasses? How about "definitely protected foo...". I like
> > the sound of "definitely".
>
> What sub-class / super-class protection relationship do you want? The
> LSP dictates only relaxation in subclasses, never tightening.

I understand that neither 'relaxation' nor 'tightening' is the aim.
'Tightening' is no topic, but unwanted 'relaxation' is the problem.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland