previous | start | next

## Protected Access

- Make CompoundShape.add method protected
- Protects HouseShape: other classes can't add graffiti
- Protected features can be accessed by subclass methods...
- ...and by methods in the same package
- Bad idea to make fields protected
  `protected GeneralPath path; // DON'T`
- Ok to make methods protected
  `protected void add(Shape s) // GOOD`
- Protected interface separate from public interface

previous | start | next